All Manuals > CLIM 2.0 User Guide > 6 Presentation Types

6.5 Predefined Presentation Types

This section documents predefined CLIM presentation types, presentation type options, and parameters. For more information on how to use these presentation types, see 6.2 How to Specify a CLIM Presentation Type.

Note that any presentation type with the same name as a Common Lisp type accepts the same parameters as the Common Lisp type (and additional parameters in a few cases).

6.5.1 Basic Presentation Types

These basic presentation types correspond to the Common Lisp types of the same name.

t Presentation Type

Summary: The supertype of all other presentation types.

nil Presentation Type

Summary: The subtype of all other presentation types. This has no printed representation, and is useful only in writing "context independent" translators, that is, translators whose to-type is nil.

null Presentation Type

Summary: The presentation type that represents "nothing". The single object associated with this type is nil, and its printed representation is None.

boolean Presentation Type

Summary: The presentation type that represents t or nil. The textual representation is Yes and No respectively.

symbol Presentation Type

Summary: The presentation type that represents a symbol.

keyword Presentation Type

Summary: The presentation type that represents a symbol in the keyword package. It is a subtype of symbol.

blank-area Presentation Type

Summary: The type that represents all the places in a window where there is no presentation that is applicable in the current input context. CLIM provides a single "null presentation" as the object associated with this type.

*null-presentation* Variable

Summary: The null presentation, which occupies all parts of a window in which there are no applicable presentations. This will have a presentation type of blank-area.

6.5.2 Numeric Presentation Types

The following presentation types represent the Common Lisp numeric types of the same name.

number Presentation Type

Summary: The presentation type that represents a general number. It is the supertype of all the number types described here.

complex Presentation Type

Summary: The presentation type that represents a complex number.

rational Presentation Type

rational &optional low high

Summary: The presentation type that represents either a ratio or an integer between low and high. Options to this type are base and radix, which are the same as for the integer type.

integer Presentation Type

integer &optional low high

Summary: The presentation type that represents an integer between low and high. Options to this type are base (default 10) and radix (default nil), which correspond to *print-base* and *print-radix*, respectively. It is a subtype of rational.

ratio Presentation Type

ratio &optional low high.

The presentation type that represents a ratio between low and high. Options to this type are base and radix, which are the same as for the integer type. It is a subtype of rational.

float Presentation Type

float &optional low high.

The presentation type that represents a floating point number between low and high.

6.5.3 Character and String Presentation Types

These two presentation types can be used for reading and writing characters and strings.

character Presentation Type

Summary: The presentation type that represents a Common Lisp character object.

string Presentation Type

string &optional length

Summary: The presentation type that represents a string. If length is specified, the string must have exactly that many characters.

6.5.4 Pathname Presentation Types

pathname Presentation Type

Summary: The presentation type that represents a pathname.

The options are default-version, which defaults to :newest, default-type, which defaults to nil, and merge-default, which defaults to t. If merge-default is nil, accept returns the exact pathname that was entered; otherwise, accept merges against the default and default-version. If no default is supplied, it defaults to *default-pathname-defaults*. pathname has a default preprocessor that merges the options into the default.

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
ArgumentsSingleMultiple

most general

completion

subset-completion

&rest elements

member

subset

sequence

member-sequence

subset-sequence

alist

member-alist

subset-alist

completion Presentation Type

completion 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:

member Presentation Abbreviation

member &rest elements

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

member-sequence Presentation Abbreviation

member-sequence 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 Presentation Abbreviation

member-alist 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 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 Presentation Type

subset-completion 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 Presentation Abbreviation

subset &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 Presentation Abbreviation

subset-sequence 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 Presentation Abbreviation

subset-alist alist &key test

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

6.5.6 Sequence Presentation Types

The following two presentation types can be used to accept and present a sequence of objects.

sequence Presentation Type

sequence type

Summary: The presentation type that represents a sequence of elements of type type. type can be a presentation type abbreviation. The printed representation of a sequence type is the elements separated by commas. accept returns a list.

The options to this type are separator and echo-space. separator is used to specify a character that will act as the separator between elements of the sequence; the default is the comma character #\,. echo-space is t or nil; when it is t (the default) a space will be automatically inserted into the input buffer when the user types a separator character.

sequence-enumerated Presentation Type

sequence-enumerated &rest types

Summary: sequence-enumerated is like sequence, except that the type of each element in the sequence is individually specified.The elements of types can be presentation type abbreviations. accept returns a list.

The options to this type are separator and echo-space, which are as for the sequence type.

6.5.7 Constructor Presentation Types

or Presentation Type

or &rest types

Summary: The presentation type that is used to specify one of several types, for example, (or (member :all :none) integer). The elements of types can be presentation type abbreviations. accept returns one of the possible types as its second value, not the original or presentation type specifier.

and Presentation Type

and &rest types

Summary: The type that is used for "multiple inheritance." and is frequently used in conjunction with satisfies, for example: (and integer (satisfies oddp)). The elements of types can be presentation type abbreviations.

The and type has special syntax that supports the two "predicates," satisfies and not. satisfies and not cannot stand alone as presentation types and cannot be first in types. not can surround either satisfies or a presentation type.

The first type in types is the type whose methods will be used during calls to accept and present.

6.5.8 Compound Presentation Types

The following compound presentation types are provided because they implement some common idioms.

token-or-type Presentation Abbreviation

token-or-type tokens type

Summary: A compound type that is used to select one of a set of special tokens, or an object of type type. tokens is anything that can be used as the sequence parameter to member-alist; typically it is a list of symbols.

null-or-type Presentation Abbreviation

null-or-type type

Summary: A compound type that is used to select nil, whose printed representation is the special token "None," or an object of type type.

type-or-string Presentation Abbreviation

type-or-string type

Summary: A compound type that is used to select an object of type type or an arbitrary string, for example: (clim:type-or-string integer). Any input that accept cannot parse as the representation of an object of type type is returned as a string.

6.5.9 Command and Form Presentation Types

The command and form presentation types are complex types provided primarily for use by the top-level interactor of an application.

expression Presentation Type

Summary: The presentation type used to represent any Lisp object. The textual view of this type looks like what the standard print and read functions produce and accept. The standard print and read functions produce and accept the textual view of this type.

A separate presentation history for each instance of an application frame is maintained for the expression presentation type.

form Presentation Type

Summary: The presentation type used to represent a Lisp form. This is a subtype of expression and is equivalent to it, except that some presentation translators produce quote forms.

command Presentation Type

command &key command-table

Summary: The presentation type used to represent a command processor command and its arguments.

A separate presentation history for each instance of an application frame is maintained for the command presentation type.

command-name Presentation Type

command-name &key command-table

Summary: The presentation type used to represent the name of a command processor command in the command table command-table.

command-or-form Presentation Type

command-or-form &key command-table

Summary: The presentation type used to represent either a Lisp form or a command processor command and its arguments.


CLIM 2.0 User Guide - 01 Dec 2021 19:38:57