Declares function with specified name, formal parameter list (can be omitted), consisting of operators, and returns its address. Declared function is compiled into managed machine code.
Example:
(DEFBIN factorial (n)
(
COND ( (ISINTEGER n) 1 ) (1 (EXIT ( – 0 1) ) )
)
(
COND ( (< n 0 ) (EXIT ( – 0 1) ) )
)
(
COND ( n ( IMUL n (factorial ( – n 1 ) ) ) ) (1 1)
)
)
This function evaluates factorial of its parameter, checking whether it is positive integer (ISINTEGER). If so, factorial of that number is returned, otherwise –1 is returned. Function result is the result of last executed operator. For immediate exit from function EXIT function is used, which returns evaluation result of its parameter. Since EXIT is always the last executed function, its result is the result of factorial function.
Pointer to this function can later be passed as parameter to functions, written in other programming languages.