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


Optional and Repeated Arguments

Some entities take optional or repeated arguments, which may be specified by a distinctive glyph that uses square brackets and ellipses. For example, a special form often breaks its argument list into separate arguments in more complicated ways than a straightforward function.

An argument enclosed within square brackets is optional. Thus, the phrase `[optional-arg]' means that optional-arg is optional. An argument followed by an ellipsis is optional and may be repeated more than once. Thus, `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 @defspec line of an example of an imaginary 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 (except it would not be split over two lines, as it is in this example).

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

The function is listed in the Command and Variable Index under `foobar'.


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