Is there an equivalent to the lisp apply function?
Take a look performand performWithArgList.
, lisp FUNCALL Io:
1 - , .. ():
plotf := method (fn, min, max, step,
for (i, min, max, step,
fn call(i) roundDown repeat(write("*"))
writeln
)
)
plotf( block(n, n exp), 0, 4, 1/2 )
2 - :
plotm := method (msg, min, max, step,
for (i, min, max, step,
i doMessage(msg) roundDown repeat(write("*"))
writeln
)
)
plotm( message(exp), 0, 4, 1/2 )
3 - :
plots := method (str, min, max, step,
for (i, min, max, step,
i perform(str) roundDown repeat(write("*"))
writeln
)
)
plots( "exp", 0, 4, 1/2 )
lisp APPLY :
apply := method (
args := call message argsEvaluatedIn(call sender)
fn := args removeFirst
performWithArgList( fn, args )
)
apply( "plotf", block(n, n exp), 0, 4, 1/2 )
apply( "plotm", message(exp), 0, 4, 1/2 )
apply( "plots", "exp", 0, 4, 1/2 )