-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
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
Remove initial value for reduce() #5797
Comments
I support deprecating the |
I believe the initial value allows one to reduce on an empty iterable, whereas without it, the default value may be unclear. |
I agree the initial value is silly given our definition of |
I suppose that anyone who really needs a behavior for an empty container can do |
What else is left to do here? Just deprecate the initial value variable? @lindahua |
Currently, when |
In 0.6, julia> reduce(+,Float64[])
0.0
julia> foldr(+,Float64[])
ERROR: BoundsError: attempt to access 0-element Array{Float64,1} at index [0]
Stacktrace:
[1] foldr(::Function, ::Array{Float64,1}) at ./reduce.jl:160
julia> foldl(+,Float64[])
0.0 Is this a separate issue? |
@dlfivefifty, I think that's a separate issue. |
|
I think the ship has sailed on this one: |
It is unclear how a initial value to reduce should be interpreted, as the associativity for reduce is undefined.
see https://groups.google.com/forum/#!topic/julia-users/7PDUKNcBtQA
The text was updated successfully, but these errors were encountered: