wrap
save a function call for later
<wrap> = wrap <command>
wrap's arguments are evaluated immediately, but function
itself is not called. Instead function along with its arguments is boxed
(or wrapped) together in a function-like object. In functional
programming this is known as partial application or currying.
$cmd := wrap print "Crash!"
$cmd = wrap $cmd "Boom!"
# same as `print "Crash!" "Boom!" "Bang!"`
run $cmd "Bang!"
wrap is also useful to create callbacks of function in a
local scope and pass it as an argument to an imported function.
| a possible dry-run switch implementation | |
| turn a local function into a callback | |
| create a closure | |