feat: supporting reduce with no initializer#70
Merged
Farenheith merged 1 commit intomasterfrom Dec 9, 2023
Merged
Conversation
63c9454 to
c9b7077
Compare
Arrays support calling reduce with no initializer, which makes the first call having the first and second elements, and the subsequent calls to behave as any other reduction call. This implementation makes reduce on fluent to do behave just like that, but with a stronger type definition. This type of call is ideal to be used when the result have the same type of the elements. If you want to change the result type, you can excplicitly inform it through generics, but be aware: if the array have only one element, the result will still have the same type of the elements, as the callback won't be called. For this reason, the result type in this case is ambiguous, and is up to the lib user to guarantee its consistency
c9b7077 to
0785dee
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
pedrosodre
approved these changes
Dec 9, 2023
codibrebot
pushed a commit
that referenced
this pull request
Dec 9, 2023
# [1.36.0](v1.35.0...v1.36.0) (2023-12-09) ### Features * supporting reduce with no initializer ([#70](#70)) ([da912a9](da912a9))
Contributor
|
🎉 This PR is included in version 1.36.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Arrays support calling reduce with no initializer, which makes the first call have the first and second elements and the subsequent calls behave as any other reduction call. This reduce implementation makes fluent to behave just like that, but with a stronger type definition.
This type of call is ideal to be used when the result has the same type of elements. If you want to change the result type, you can explicitly inform it through generics, but be aware: if the array has only one element, the result will still have the same type of elements, as the callback won't be called. For this reason, the result type in this case is ambiguous, and is up to the lib user to guarantee its consistency