REDUCE

21.7 Symbolic Procedures

All the functions described in the Standard Lisp Report are available to users in symbolic mode. Additional functions may also be defined as symbolic procedures. For example, to define the Lisp function assoc, the following could be used:

        symbolic procedure assoc(u,v);
           if null v then nil
            else if u = caar v then car v
            else assoc(u, cdr v);

If the default mode were symbolic, then symbolic could be omitted in the above definition. macros may be defined by prefixing the keyword procedure by the word macro. (In fact, ordinary functions may be defined with the keyword expr prefixing procedure as was used in the Standard Lisp Report.) For example, we could define a macro conscons by

        symbolic macro procedure conscons l;
           expand(cdr l,’cons);

Another form of macro, the smacro is also available. These are described in the Standard Lisp Report. The Report also defines a function type fexpr. However, its use is discouraged since it is hard to implement efficiently, and most uses can be replaced by macros. At the present time, there are no fexprs in the core REDUCE system.


Hosted by Download REDUCE Powered by MathJax