defset [Macro]


Purpose

The defset macro defines or redefines a symbolic set.

Syntax

defset name &optional documentation &key is annotations identifier kb

Arguments

The name argument is a symbol. If name is null, the set is given a system-generated name.

The documentation argument is a string which attaches a comment to the set being defined. This string can be retrieved by calling the Lisp documentation function with type as the doc-type argument.

The is argument is a set-forming expression (see Remarks below) that defines the set as a group of ordered or unordered symbolic constants.

The annotations argument is a list of facts to be asserted about the set being defined. Each element of the list is either a concept name or an expression having the form (RelationName instance), where instance is either a constant or a symbol that identifies a Loom instance.

The identifier argument is the name under which the set will be interned in the :instances partition of its knowledge base. This argument defaults to name.

The kb argument is a string or symbol that names the knowledge base in which the set is to be interned. This defaults to the current knowledge base.

Value

The defined or redefined set is returned.

Remarks

All symbolic set members appearing in a defset should be quoted.

The defconcept macro should be used for defining non-symbolic sets such as numeric intervals or sets of Loom objects.

  set-expr ::= 
      SetName | 
      ( {:AND | :OR} set-expr+ ) | 
      ( {:ONE-OF | :THE-ORDERED-SET} Symbol+ ) | 
      ( :THROUGH Symbol Symbol ) ;
The set-forming expressions that appear in the is argument above have the following syntax:

The set-forming operators have the following semantics:

Examples

(defset Color :is (:one-of 'Red 'Green 'Blue \ldots)) ==> |C|COLOR 
(defset Day :is (:the-ordered-set 'Monday 'Tuesday \ldots 'Sunday))
(defset Weekday :is (:and Day (:through 'Monday 'Friday)))

See Also

Last modified: Jun 1 1995