13.3 Optional and Repeated Arguments

Some entities take optional or repeated arguments. One convention for indicating these uses square brackets and ellipses: an argument enclosed within square brackets is optional, and an argument followed by an ellipsis is optional and may be repeated more than once.

Thus, [optional-arg] means that optional-arg is optional and repeated-args stands for zero or more arguments. Parentheses are used when several arguments are grouped into additional levels of list structure in Lisp.

Here is the definition line of an example of an imaginary (complicated) special form:

Special Form: foobar (var [from to [inc]]) body…

In this example, the arguments from and to are optional, but must both be present or both absent. If they are present, inc may optionally be specified as well. These arguments are grouped with the argument var into a list, to distinguish them from body, which includes all remaining elements of the form.

In a Texinfo source file, this @defspec line is written like this:

@defspec foobar (var [from to [inc]]) body@dots{}