I’ve found a groovy code snippet similar to the next one:
def f1 = { print "Hello, ${it}" }
def f2 = { "world" }
(f2 >> f1)()
It looks like such construction works only between closures. This code also works with left shift operator ((f1 << f2)()).
I wonder how is this operator (or this technique) called?
It does closure composition.
See the
rightShiftandleftShiftoperator overloading API docs.Overriding shift operators is a pretty common technique, like for adding items to a collection.