7 ms·
I think the misunderstanding is about iterators "not relying on concrete types". Rather, iterators are the concrete type. Consider the example transformation fr
by joe-user 5mo ago
I think the misunderstanding is about iterators "not relying on concrete types". Rather, iterators are the concrete type. Consider the example transformation from the transducers page:
(def xf
(comp
(filter odd?)
(map inc)
(take 5)))
You'll see there's no notion of a concrete type that the transformation operates on. It can work with vectors, seqs, core.async channels, etc. Now consider how that could be written in JavaScript such that it works on arrays, sets, generators, iterators, etc. without having to first convert to another type (such as an iterator). That is what's meant about transducers not being tied to a concrete type.
- css_apologist 5mo agoi see so it's more than all tranducable types implement a common interface? or the tranduceable operators depend on a small subset of generic functions?