-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
In "My First Functor", there is this example:
Container.of('bombs').map(concat(' away')).map(prop('length'));
// Container(10)Assuming that concat is defined as in appendix C:
const concat = curry((a, b) => a.concat(b));Container.of('bombs').map(concat(' away'))
gives the result
Container(' awaybombs')
and not
Container('bombs away')
which I suppose was the intended meaning...
Of course both give the final answer 10 :-)
Shouldn't the example be:
Container.of('bombs').map(append(' away')).map(prop('length'));
// Container(10)where append is:
const append = flip(concat);or something similar?
Or is maybe concat defined as
const concat = curry((a, b) => b.concat(a));but then it would be difficult to know what function concat does without looking at the implementation...
Any thoughts on this?
Reactions are currently unavailable