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

Read Macros

In order to facilitate writing pattern-var and pattern-form, a read macro is defined. More specifically, ? character is used to denote the beginning of the pattern-var and ! character is used to denote the beginning of the pattern-form. Inside the pattern-var, & character signifies the start of the value-restriction and ! character signifies the start of the form-restriction. The syntax is given below.

 pattern-var-read ::= ?pattern-var-name{&value-restriction}*[!form-restriction] 
 pattern-form-read ::= !lisp-form 

There should be no space before & and ! characters inside pattern-var-read. The pattern-var-read is expanded to a corresponding pattern-var at the read time, and the pattern-form-read is also expanded to a corresponding pattern-form at the read time.

Example:

?var&(> 3)&(< 5)!(test ?var)
   =>(:? var :value-restriction ((> 3)(< 5))
             :form-restriction (test (:? var)))
!(test-form ?var)
   =>(:! (test-form (:? var)))

Macro: use-readtable &optional readtable-name

When the customized readtable mentioned above is used, the Common Lisp variable *readtable* needs to be set appropriately. This macro is provided for this purpose, and this macro should be called right after (in-package ...) in the program file. readtable-name is provided for a Lisp implementation which has the named readtable facility such as Allegro Common Lisp Ver. 4.2. In this implementation, AgenTalk's customized readtable is defined as the named readtable :agentalk, and the default value of readtable-name is :agentalk. In other Lisp implementations, readtable-name should not be specified.


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