NextPrevUpTopContentsIndex

6.5.5 One-Of and Some-Of Presentation Types

The "one-of" and "some-of" presentation types can be used to accept and present one or more items from a set of items. The set of items can be specified as a "rest" argument, a sequence, or an alist.

This table summarizes single ("one-of") and multiple ("some-of") selection presentation types. Each row represents a type of presentation. Columns contain the associated single and multiple selection presentation types.

 

One-Of and Some-Of Selection Presentation Types

Arguments

Single

Multiple

most general

completion

subset-completion

&rest elements

member

subset

sequence

member-sequence

subset-sequence

alist

member-alist

subset-alist

completion

Arguments: sequence &key test value-key

Summary: The presentation type that selects one from a finite set of possibilities, with "completion" of partial inputs. Several types are implemented in terms of the completion type, including token-or-type , null-or-type , member , member-sequence , and member-alist .

sequence is a list or vector whose elements are the possibilities. Each possibility has a printed representation, called its name, and an internal representation, called its value. accept reads a name and returns a value. present is given a value and outputs a name.

test is a function that compares two values for equality. The default is eql .

value-key is a function that returns a value, given an element of sequence . The default is identity .

The following presentation type options are available:

name-key is a function that returns a name as a string, given an element of sequence . The default is a function that behaves as follows:

string -> the string

null -> "NIL"

cons -> string of the car

symbol -> string-capitalize of its name

otherwise -> princ-to-string of it

documentation-key is a function that returns either nil or a descriptive string, given an element of sequence . The default always returns nil .

test , value-key , name-key , and documentation-key must have indefinite extent.

partial-completers is a possibly empty list of characters that delimit portions of a name that can be completed separately. The default is a list of one character, #\Space .

member

Arguments: &rest elements

Summary: The presentation type that specifies one of elements. The options are the same as for completion .

member-sequence

Arguments: sequence &key test

Summary: Like member , except that the set of possibilities is the sequence sequence. The parameter test and the options are the same as for completion .

member-alist

Arguments: alist &key test

Summary: Like member , except that the set of possibilities is the alist alist. Each element of alist is either an atom, as in member-sequence , or a list whose car is the name of that possibility and whose cdr is one of the following:

The value (which must not be a cons)

A list of one element, the value

A property list that can contain the following properties:

:value --the value

:documentation --a descriptive string

The test parameter and the options are the same as for completion except that value-key and documentation-key default to functions that support the specified alist format.

subset-completion

Arguments: sequence &key test value-key

Summary: The type that selects one or more from a finite set of possibilities, with "completion" of partial inputs. The parameters and options are the same as for completion , plus the additional options separator and echo-space , which are as for the sequence type. The subset types that follow are implemented in terms of the subset-completion type.

subset

Arguments: &rest elements

Summary: The presentation type that specifies a subset of elements. Values of this type are lists of zero or more values chosen from the possibilities in elements . The printed representation is the names of the elements separated by commas. The options are the same as for completion .

subset-sequence

Arguments: sequence &key test

Summary: Like subset , except that the set of possibilities is the sequence sequence. The parameter test and the options are the same as for completion .

subset-alist

Arguments: alist &key test

Summary: Like subset , except that the set of possibilities is the alist alist.


Common Lisp Interface Manager 2.0 User's Guide - 27 Feb 2008

NextPrevUpTopContentsIndex