The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

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 (116) [Avatar] Offline
#2
Thanks for pointing out .. will correct in the next MEAP ..