I encountered andThen, but did not properly understand it.
andThen
To look at it further, I read the Function1.andThen docs
def andThen[A](g: (R) ⇒
andThen is just function composition. Given a function f
f
val f: String => Int = s => s.length
andThen creates a new function which applies f followed by the argument function
val g: Int => Int = i => i * 2 val h = f.andThen(g)
h(x) is then g(f(x))
h(x)
g(f(x))