I\'m following the tutorial Pattern matching & functional composition on Scala compose
and andThen
methods. There\'s such an example:
addAhem
is a method. compose
method is defined on functions. addAhem _
converts addAhem
from method to function, so compose
can be called on it. compose
expects a function as it's argument. You are giving it a method addUmm
by converting addUmm
into a function with addUmm _
(The underscore can be left out because the compiler can automatically convert a method into a function when it knows that a function is expected anyway). So your code:
addAhem _ compose addUmm
is the same as
(addAhem _).compose(addUmm)
but not
addAhem(_).compose(addUmm(_))
PS I didn't look at the link you provided.