Because closure references are just instances of java.lang.invoke.MethodHandle, you can bind its
first argument using the bindTo(value) method. If you need to bind an argument at another position
than 0, you may take advantage of the bindAt(position, value) augmentation:
let diff = |a, b| -> a - b let minus10 = diff: bindAt(1, 10) # 10 println(minus10(20))
You may compose function using the andThen augmentation method:
let f = (|x| -> x + 1): andThen(|x| -> x - 10): andThen(|x| -> x * 100) # -500 println(f(4))
or:
function foo = |x| -> x + 1
function bar = |x| -> 2 * x
function main = |args| {
let newFunction = ^foo: andThen(^bar)
# 8
println(newFunction(3))
}