We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The current docstring for reduce2 states:
reduce2
The 2-argument version of reduce that does not take an initialization value. Instead, the first element of the array is used for initialization.
reduce
My reading of this is that it leaves unspecified what to do when ind is empty.
ind
According to this commit, the current behavior of returning nil is intentional:
nil
(reduce2 + []) # => nil
It seems like there are at least two other reasonable ways to handle an empty ind argument:
f
It seems that approach 2 is what Common Lisp went for [1].
If the current behavior is the most desirable, may be it would make sense to update the docstring?
[1] See this comment for more details.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The current docstring for
reduce2
states:My reading of this is that it leaves unspecified what to do when
ind
is empty.According to this commit, the current behavior of returning
nil
is intentional:It seems like there are at least two other reasonable ways to handle an empty
ind
argument:f
argument with zero argumentsIt seems that approach 2 is what Common Lisp went for [1].
If the current behavior is the most desirable, may be it would make sense to update the docstring?
[1] See this comment for more details.
The text was updated successfully, but these errors were encountered: