Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

The Evaluator

The process of evaluation in XLISP:

Strings, integers, characters, floats, objects, arrays, streams, subrs, fsubrs and closures evaluate to themselves.

Symbols act as variables and are evaluated by retrieving the value associated with their current binding.

Lists are evaluated by examining the first element of the list and then taking one of the following actions:

If it is a symbol, the functional binding of the symbol is retrieved.

If it is a lambda expression, a closure is constructed for the function described by the lambda expression.

If it is a subr, fsubr or closure, it stands for itself.

Any other value is an error.

Then, the value produced by the previous step is examined:

If it is a subr or closure, the remaining list elements are evaluated and the subr or closure is called with these evaluated expressions as arguments.

If it is an fsubr, the fsubr is called using the remaining list elements as arguments (unevaluated).

If it is a macro, the macro is expanded using the remaining list elements as arguments (unevaluated). The macro expansion is then evaluated in place of the original macro call.


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