There is a paragraph here stating:
Composition of the transformer runs right-to-left but builds a transformation stack that runs left-to-right (filtering happens before mapping in this example).
I don't get it. What does this mean: Composition of the transformer runs right-to-left (from the bottom in this example)
(def xf
(comp
(filter odd?)
(map inc)
(take 5)))
For me all I see is how this composition will execute, it will filter, map and take. What's the point of composition order from the bottom. It seems an important point in the article so I try to not miss the point.
I will try to answer quickly; Begging the question:
Compiler knows
map
is followed by atake
. So unfolding the composition to compile it, it will sequentially definemap
, thentake
function, although execution graph starts from the bottom.