Say we have an object (e.g. a list) in Scala, and we want to sequence user-defined functions with object member functions, for instance:
g(l.map(f)
.foldRight(...))
.map(h)
If the sequence of functions is larger, the code gets a little messy. Is there a better way to write such a code? Maybe something like:
l.map(f)
.foldRight(...)
.call(g) // call would simply call function g on the resulting object
.map(h)