You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got ahead of myself and already started working on an implementation. Assuming you think this function is useful to include in the stdlib, the only thing I'm unsure of now is how to type the accumulator value of the closure.
The simplest answer is to treat it as Kind::ANY but this always requires type assertions and handling within the function.
My current implementation treats it as the same type as initial_value, with some small changes to the internals.
The ideal seems to be a union between the initial_value and closure return type - although this probably requires further changes to the internals
The text was updated successfully, but these errors were encountered:
Having a fold function like the rust's Iterator::fold would be a nice-to-have for compacting objects array into a single value.
Consider the contrived issue of trying to tally the total count of elements parsed out of a line
This is currently possible but requires side effects to accomplish:
A fold function provides a slightly more terse way to accomplish this.
I got ahead of myself and already started working on an implementation. Assuming you think this function is useful to include in the stdlib, the only thing I'm unsure of now is how to type the accumulator value of the closure.
Kind::ANY
but this always requires type assertions and handling within the function.initial_value
, with some small changes to the internals.initial_value
and closure return type - although this probably requires further changes to the internalsThe text was updated successfully, but these errors were encountered: