3 ms·
Well, in Clojure they solve the problem that the standard functions are inefficient when you chain a bunch of list manipulations together (because they all retu
by moomin 11y ago
Well, in Clojure they solve the problem that the standard functions are inefficient when you chain a bunch of list manipulations together (because they all return lazy lists) and neatly sidestep the fact that Clojure doesn't have generators.
- ch 11y agoSo if Clojure had some form of fusion of composed functions on lists, that would equate out to what transducers are doing?
- fnordsensei 11y agoThat's almost literally what happens. (comp (map inc) (filter even?)) when applied takes all even numbers from a collection/channel/what-have-you and adds one to them. Filter and map normally take a collection as their last argument, but when none are supplied, a transducer is returned instead.