Special forms, although syntactically equivalent to macros, differ from macros in that their arguments are not automatically evaluated before they are called. The evaluation of their arguments usually depend on some condition of some other argument.
%<number=23>\ %cond(%[number < 10],less than 10, %[number < 50],less than 50 but greater than 9, else,greater than 49) => less than 50 but greater than 9
else
,alternative]])
else
clause is specified and the string
is contained in no list, its alternative is evaluated. Otherwise,
nothing is done. Example:
%<number=7>\ %case(%number, %list(0,2,4,6,8),even, %list(1,3,5,7,9),odd) => odd
A few examples:
%for(i,1,10,%i%' ') => 1 2 3 4 5 6 7 8 9 10 %for(i,10,1,%i%' ') => 10 9 8 7 6 5 4 3 2 1 %for(i,1,10,2,%i%' ') => 1 3 5 7 9 %for(i,10,1,-2,%i%' ') => 10 8 6 4 2 %for(i,1,10,0,%i%' ') error--> increment in for-loop cannot be zero %for(i,10,1,1,%i%' ') =>
0
. If all exprs
evaluate to boolean TRUE, returns 1
. This means that if one
expr evaluates to FALSE, all exprs to its right do not get
evaluated. If and
is called without parameters, it returns
1
.
1
. If all exprs
evaluate to boolean FALSE, returns 0
. This means that if one
expr evaluates to TRUE, all exprs to its right do not get
evaluated. If or
is called without parameters, it returns
0
.
Go to the first, previous, next, last section, table of contents.