News for hackers. Stuff that matters.
Re:Magical, Mystical JavaScript Transducers by chris_st on Saturday June 29, 2019 @08:17AM (#20312149)
Downside: Still going over the array multiple times.
Re:Magical, Mystical JavaScript Transducers by sli on Monday July 01, 2019 @03:09PM (#20328685)
You could (usually, but not always) compose the functions you're passing into filter and map and use reduce instead to do both operations in a single pass.

(Edit: This is a big point in the article -- apologies, I hadn't finished reading it yet.)

Re:Magical, Mystical JavaScript Transducers by agumonkey on Saturday June 29, 2019 @09:03AM (#20312346)
fair point, in js it will, in other languages that idiom gets deforested into a single pass though
Re:Magical, Mystical JavaScript Transducers by chris_st on Saturday June 29, 2019 @06:03PM (#20315074)
Cool, which languages do this?
Re:Magical, Mystical JavaScript Transducers by cofunctor on Saturday June 29, 2019 @06:30PM (#20315211)
This ought to work with any lazy language (or lazy data structure), which is one of the huge benefits of laziness for FP.