Explicit-Slot Templates

The most commonly used form of template is the "explicit-slot" form, which is sometimes called the "question mark" form.

Example:

SHOW MAP [? * ?] [2 3 4 5]
[4 9 16 25]

In this example, MAP evaluates the template [? * ?] repeatedly, with each of the members of the data list [2 3 4 5] substituted in turn for the question marks. The same value was used for every question mark in a given evaluation. Some tools allow for more than one datum to be substituted in parallel; in these cases the slots are indicated by ?1 for the first datum, ?2 for the second, and so on.

Example:

SHOW (MAP [(WORD ?1 ?2 ?1)] [a b c] [d e f])
[ada beb cfc]

If the template wishes to compute the datum number, the form (? 1) is equivalent to ?1, so (? ?1) means the datum whose number is given in datum number 1. Some tools allow additional slot designations, as shown in the individual descriptions.


SourceForge.net Logo