jon hanson (1) [Avatar] Offline
#1
Hi,

In the following text in section 2.3.1 :
Note we use “andThen” here – f andThen g means f(g(x)). There’s another combinator “compose” – f compose g means g(f(x)).
I believe the definitions are the wrong way around - the Scala docs state :
def andThen[A](g: (R) ? A): (T1) ? A

Composes two instances of Function1 in a new Function1, with this function applied first.
def compose[A](g: (A) ? T1): (A) ? R

Composes two instances of Function1 in a new Function1, with this function applied last.
I.e.:

f andThen g means g(f(x)), and
f compose g means f(g(x)).

rgds,
Jon
Debasish Ghosh (113) [Avatar] Offline
#2
Thanks for pointing out .. will correct in the next MEAP ..