Symbolic Procedures
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 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 deﬁned as symbolic procedures. For example, to deﬁne 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 deﬁnition. MACROs may be deﬁned by preﬁxing the keyword PROCEDURE by the word MACRO. (In fact, ordinary functions may be deﬁned with the keyword EXPR preﬁxing PROCEDURE as was used in the Standard Lisp Report.) For example, we could deﬁne 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 deﬁnes a function type FEXPR. However, its use is discouraged since it is hard to implement eﬃciently, and most uses can be replaced by macros. At the present time, there are no FEXPRs in the core REDUCE system.

Up | Next | Prev | PrevTail | Front