MacroPackage: top-levelToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version


Arguments: name args &rest body

This macro is used to define top-level aliases. The syntax of alias is similar to that of defun, and body can be anything acceptable in the body of a lambda expression. name can be a string or a list of a string and options. The string is the name of the top-level alias. If (string option*) is used, the options are (either or both may be specified) the keyword :case-sensitive and the integer abbreviation index.

As with defun, if there is more than one form after the argument list, and the first form is a string, it is assumed to be a documentation string and is used for documenting the command. The :help top-level command will display the new command created by alias and will use the documentation string, if present, for documentation.

If the :case-sensitive option is chosen, the arguments will be read in case-sensitive mode without regard to the current reader mode. This option is most appropriate when the argument is a filename. Case-sensitivity is fully described in case.htm.

If an abbreviation index is supplied, it must be an integer which is interpreted as an index into the string specified by the string which is either the value of or the first element of name. This index identifies the shortest substring which will stand for the entire command. Note that string indexing is zero-based. For example,

("load" 1)

specifies that lo and loa are valid abbreviations for load, while

("load" 0)

specifies l as well. Note that it is possible that the same substring will be common to more than one command. In that case, the substring calls the most recently defined command. However, no warning is printed when a command is defined that leads to such a conflict.

args is the list of formal parameters to the alias, and has the same form as the formal list of a lambda expression.

An alias can also be defined with setf, in the following way:

  (setf (top-level:alias "foo") 
     #'(lambda (arg) (format t "foo: arg is ~s~%"

That form has the same effect as:

  (top-level:alias "foo" (arg) 
             (format t "foo: arg is ~s~%"

This operator is not available in Lisp images built with a minimal top level, that is built with the include-tpl argument to build-lisp-image specified nil. See Minimal top levels in building-images.htm for information on minimal top levels.

See top-level.htm for more information on the top level.

Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.

Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version