naveen.chwl at gmail.com
Wed Aug 30 13:46:26 UTC 2017
`takeWhile` would work as follows:
myArray.takeWhile(element=>true) //Simplest case. Iterates over all
elements and returns a new array of them
It returns a new array with the consecutive elements from the start all of
whose predicates returns truthy. Thusly it allows iteration with a custom
exit condition, e.g.
Prior art: Java 9, rxjs, lodash and possibly others
On Tue, 29 Aug 2017 at 21:27 Allen Wirfs-Brock <allen at wirfs-brock.com>
> On Aug 28, 2017, at 12:29 PM, Sebastian Malton <sebastian at malton.name>
> The outcome of this basically means "return from current context up one
> level and then return from there”.
> This would be a terrible violation of functional encapsulation. How do
> you know that the (e.g.) forOf function isn’t internally using a
> encapsulated helper function that is making the actual call to the call
> back. You simply have no way to predict where returning from the current
> context “up one” means.
> A current method of doing this is by using try / catch but it is not
> ideal. Using the above method I believe that it would be able to be better
> This technique provides a meaningful semantics because it allows the
> controlling outer function to define what early return means.
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss