23.8 Standard Presentation Types

  • 23.8.1 Basic Presentation Types
  • 23.8.2 Numeric Presentation Types
  • 23.8.3 Character and String Presentation Types
  • 23.8.4 Pathname Presentation Type
  • 23.8.5 "One-of" and "Some-of" Presentation Types
  • 23.8.6 Sequence Presentation Types
  • 23.8.7 "Meta" Presentation Types
  • 23.8.8 Compound Presentation Types
  • 23.8.9 Lisp Expression Presentation Types
  • The following sections document the presentation types supplied by CLIM. 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). [annotate]

    23.8.1 Basic Presentation Types

    t   [Presentation Type]
              

    The supertype of all other presentation types. [annotate]

    [annotate]

    nil   [Presentation Type]
              

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

    [annotate]

    null   [Presentation Type]
              

    The type that represents "nothing". The single object associated with this type is nil, and its printed representation is "None". [annotate]

    [annotate]

    boolean   [Presentation Type]
              

    The type that represents true or false. The printed representation is "Yes" or "No", respectively. [annotate]

    [annotate]

    symbol   [Presentation Type]
              

    The type that represents a symbol. [annotate]

    [annotate]

    keyword   [Presentation Type]
              

    The type that represents a symbol in the keyword package. It is a subtype of symbol. [annotate]

    [annotate]

    blank-area   [Presentation Type]
              

    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. [annotate]

    [annotate]

    *null-presentation*   [Constant]
              

    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. [annotate]

    [annotate]

    23.8.2 Numeric Presentation Types

    complex  &optional type [Presentation Type]
              

    The type that represents a complex number. It is a subtype of number. [annotate]

    The components of the complex number are of type type, which must be real or a subtype of real. [annotate]

    [annotate]

    Note: Parameter name "type" is unfortunate, because DEFINE-PRESENTATION-METHOD mandates that "All presentation methods except presentation-subtypep have lexical access to the parameters from the presentation type specifier." In other words, this variable shadows the method argument named type in presentation methods. We rename this parameter to PART-TYPE (the symbol is now exported from the CLIM package). [edit]-- DK 2020-07-01 12:01Z
     

    real  &optional low high [Presentation Type]
              

    The type that represents either a ratio, an integer, or a floating point number between low and high. low and high can be inclusive or exclusive, as in Common Lisp type specifiers. Options to this type are base (default 10) and radix (default nil). real is a subtype of number. [annotate]

    [annotate]

    rational  &optional low high [Presentation Type]
              

    The type that represents either a ratio or an integer between low and high. Options to this type are base and radix. rational is a subtype of real. [annotate]

    [annotate]

    integer  &optional low high [Presentation Type]
              

    The type that represents an integer between low and high. Options to this type are base and radix. integer is a subtype of rational. [annotate]

    [annotate]

    ratio  &optional low high [Presentation Type]
              

    The type that represents a ratio between low and high. Options to this type are base and radix. ratio is a subtype of rational. [annotate]

    [annotate]

    float  &optional low high [Presentation Type]
              

    The type that represents a floating point number between low and high. float is a subtype of number. [annotate]

    [annotate]

    23.8.3 Character and String Presentation Types

    character   [Presentation Type]
    string  &optional length [Presentation Type]

    23.8.4 Pathname Presentation Type

    pathname   [Presentation Type]
              

    The 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 true. If merge-default is false, 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*. The pathname type should have a default preprocessor that merges the options into the default. [annotate]

    [annotate]

    Note:

    DEFAULT-TYPE coincides with the ACCEPT keyword argument (and shadows it). We don't change its name, because this may be easily fixed in the method lambda list, i.e

    ((:default-type accept-default-type) type)

    [edit]-- DK 2020-07-01 12:00Z
     

    23.8.5 "One-of" and "Some-of" Presentation Types

    completion  sequence &key test value-key [Presentation Type]
              

    The type that selects one from a finite set of possibilities, with "completion" of partial inputs. The member types below, token-or-type, and null-or-type are implemented in terms of the completion type. [annotate]

    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. [annotate]

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

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

    The following presentation type options are available: [annotate]

    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
    [annotate]

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

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

    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. [annotate]

    [annotate]

    member  &rest elements [Presentation Type Abbreviation]
    member-sequence  sequence &key test [Presentation Type Abbreviation]
              

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

    [annotate]

    member-alist  alist &key test [Presentation Type Abbreviation]
              

    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: [annotate]

    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. [annotate]

    [annotate]

    subset-completion  sequence &key test value-key [Presentation Type]
              

    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 below are implemented in terms of the subset-completion type. [annotate]

    [annotate]

    subset  &rest elements [Presentation Type Abbreviation]
              

    The 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. [annotate]

    [annotate]

    subset-sequence  sequence &key test [Presentation Type Abbreviation]
              

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

    [annotate]

    subset-alist  alist &key test [Presentation Type Abbreviation]
              

    Like subset, except that the set of possibilities, the parameters, and the options are as for member-alist. [annotate]

    [annotate]

    23.8.6 Sequence Presentation Types

    sequence  type [Presentation Type]
              

    The 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. It is unspecified whether accept returns a list or a vector. [annotate]

    Note: Parameter name "type" is unfortunate, because DEFINE-PRESENTATION-METHOD mandates that "All presentation methods except presentation-subtypep have lexical access to the parameters from the presentation type specifier.". In other words, this variable shadows the method argument named type in presentation methods. We rename it after CLIM-TOS to ELEMENT-TYPE. [edit]-- DK 2020-07-01 11:58Z
     

    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 must be true or false; when it is true (the default) a space will be automatically inserted into the input buffer when the user types a separator character. [annotate]

    [annotate]

    sequence-enumerated  &rest types [Presentation Type]
              

    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. It is unspecified whether accept returns a list or a vector. [annotate]

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

    [annotate]

    23.8.7 "Meta" Presentation Types

    or  &rest types [Presentation Type]
              

    The 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. [annotate]

    The accept method for or could be implemented by iteratively calling accept on each of the presentation types in types. It would establish a condition handler for parse-error, call accept on one of the types and return the result if no condition was signalled. If a parse-error is signalled, the accept method for or would call accept on the next type. When there are no more types, the accept method for or would itself signal a parse-error. [annotate]

    [annotate]

    and  &rest types [Presentation Type]
              

    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. [annotate]

    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. [annotate]

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

    [annotate]

    23.8.8 Compound Presentation Types

    token-or-type  tokens type [Presentation Type Abbreviation]
              

    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. [annotate]

    [annotate]

    null-or-type  type [Presentation Type Abbreviation]
              

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

    [annotate]

    type-or-string  type [Presentation Type Abbreviation]
              

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

    [annotate]

    23.8.9 Lisp Expression Presentation Types

    expression   [Presentation Type]
              

    The type used to represent any Lisp object. The standard print and read functions produce and accept the textual view of this type. [annotate]

    If a presentation history is maintained for the expression presentation type, it should be maintained separately for each instance of an application frame. [annotate]

    [annotate]

    form   [Presentation Type]
              

    The type used to represent a Lisp form. This is a subtype of expression and is equivalent except that some presentation translators produce quote forms. [annotate]

    [annotate]