next up previous

9.3.3.1 Slot Field Type

A slot can hold either a singlefield or multifield value. By default, a slot is singlefield. The keyword multislot specifies that a slot can hold a multifield value comprised of zero or more fields, and the keywords slot or single-slot specify that the slot can hold one value. Multifield slot values are stored as multifield values and can be manipulated with the standard multifield functions, such as nth$ and length$, once they are retrieved via messages. COOL also provides functions for setting multifield slots, such as slotinsert$ (see section 12.16.4.12.2). Single-field slots are stored as a CLIPS primitive type, such as integer or string.

Example

CLIPS> (clear)
CLIPS>
(defclass A (is-a USER)
    (role concrete)
    (multislot foo (create-accessor read)
                (default abc def ghi)))
CLIPS> (make-instance a of A)
[a]
CLIPS> (nth$ 2 (send [a] get-foo))
def
CLIPS>


next up previous