RosettaCodeData/Task/Currying/Io/currying.io

13 lines
240 B
Io
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
curry := method(fn,
2026-02-01 16:33:20 -08:00
a := call evalArgs slice(1)
block(
b := a clone appendSeq(call evalArgs)
performWithArgList("fn", b)
)
2023-07-01 11:58:00 -04:00
)
// example:
increment := curry( method(a,b,a+b), 1 )
increment call(5)
// result => 6