17.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.