Go to the first, previous, next, last section, table of contents.


call

Control-struct: call { ... fn -> ... }
file: job.t
package: muf
status: alpha

The call{ inargs -> outargs } syntax generates code which accepts one compiledFunction (or a symbol with appropriate functional value) and invokes it, after checking that the compiledFunction's arity is as declared. (But a call{ -> ? } matches any function.) Thus, if anyone complains that in Muq MUF you must do 2 2 + to add two and two, you may easily demonstrate that there are actually many more ways:

Stack:
2 2 +
Stack: 4
pop 2 2 '+ call{ $ $ -> $ }
Stack: 4
pop 2 2 :: + ; call{ $ $ -> $ }
Stack: 4
pop 2 2 :: + ; : c call{ $ $ -> $ } ; c

The call{...} syntaxis is the intended mechanism for invoking functions which are passed as arguments or plucked at runtime from the database.

Note: An older syntax of simply call still exists. It can be useful in exceptional cases where you need and want to call a function of no particular arity, as for example in a user shell.


Go to the first, previous, next, last section, table of contents.