2 ms·
When working with functional programming, thinking about "doing" is often the wrong approach, because "doing" is often tied to "change of state". Instead, think
by jowiar 12y ago
When working with functional programming, thinking about "doing" is often the wrong approach, because "doing" is often tied to "change of state". Instead, think about translations/transformations from "what I have" to "what I want".
clickStream.map(f) doesn't "do" anything - it takes a stream, and returns another stream that's the result of f applied to each element of clickStream.
So if I do something like:
astream = clickStream.map(a)
bstream = clickStream.map(b)
cstream = clickStream.map(c)
I've created three streams that are each the result of a particular function applied to the elements of an original stream.