News for hackers. Stuff that matters.
Re:FP techniques that will help you write better JavaScript by setr on Friday February 11, 2022 @01:55PM (#30305530)
If the language implements them as lazy iteration, then I think take_until would be effectively equivalent to break, with early exiting behavior.

List.where(…).map(…).take_until(…)

Re:FP techniques that will help you write better JavaScript by dragonwriter on Friday February 11, 2022 @04:54PM (#30307473)
> If the language implements them as lazy iteration

JS doesn't, though.

> then I think take_until would be effectively equivalent to break

JS also doesn't have take_until.

Re:FP techniques that will help you write better JavaScript by bryanrasmussen on Saturday February 12, 2022 @01:33AM (#30310481)
>JS also doesn't have take_until.

I just assumed it was a new method coming out soon! Although when I was thinking of how I would make a method I just thought an until method that iterated all elements of an array outputting them until it got the return from the callback that was passed as the iteration stopper - default value null.

Re:FP techniques that will help you write better JavaScript by bryanrasmussen on Friday February 11, 2022 @04:28PM (#30307189)
maybe, but that seems a weird way to say you can do it.