Sib-pair Command: %


ClassMacro
Name%
Arguments<variable_name> | <parameter_name>

A number or string prepended by the % (percent) character is a macro parameter or macro variable respectively.

%<nam> macro variable - replaced by contents of macro
%(<nam>)macro variable - replaced by contents of macro
%% macro function call "process ID" (random) string
%1 %2..%N positional arguments of a macro function
%0 all the arguments of a macro function
%+N all the macro arguments from Nth onwards

When a macro function is called from the command line, the words following the keyword are taken as positional arguments. In the body of the function, the token %1 is replaced by the first argument, %2 the second argument etc. The token %0 is replaced by all the arguments, while %+1 is replaced by all but the first argument, %+2, the third argument onwards and so forth.

A macro variable, by contrast, can appear anywhere within a standard Sib-pair command. The token is replaced by the contents of the macro matching the name, but its contents are then evaluated for further macro expansion. To allow inclusion of a macro within a string, its name may be enclosed in brackets in the usual fashion eg "%(a)".

The name of a macro variable or function must contain at least one letter, and may contain digits and underscores.

Example:

>> macro a=+
>> macro a2=2
>> macro add
%1 + %2
;;;;
>> 2 %a 2
=> 4.
>> 2%a2
=> 22.
>> 2%(a)2
=> 4.
>> add 2 2
=> 4.


<< (macro)Up to index>> (let)