groovy Currying Index based currying


Example

def quatNorm = { a, b, c, d ->
    Math.sqrt(a*a + b*b + c*c + d*d)
}
assert quatNorm(1, 4, 4, -4) == 7.0

def complexNorm = quatNorm.ncurry(1, 0, 0) // b, c == 0
assert complexNorm(3, 4) == 5.0