Sorry, none of this comes remotely close to what Lisp provides.
Also the code you wrote won't pass production code review at any decent Java shop.
Also the code you wrote won't pass production code review at any decent Java shop.
f = { it * 3 }
g = { it + 4 }
h = f << g
h(2)
18
The reason this is not particularly common usage is not because you can't do it, but because most people don't find it very intuitive. list << x
or writing to a stream: new File('test.txt') << 'hello world'
So if you read it as "forward the result of g into f" then it makes a little more sense.But I agree, it's still not very intuitive and for readability I would normally just write:
h = { f(g(it)) }
Which I think is far clearer. But that's partly an argument against functional programming style itself which would ordinarily see function composition as more idiomatic.