All Manuals > KnowledgeWorks and Prolog User Guide > 7 Reference Guide

def-kb-struct Macro

Summary

Defines a structure class for use in the object base.

Package

kw

Signature

def-kb-struct name-and-options {slot-description}* => name

name-and-options ::= name | (name {option}*)

option ::= (:include superclass) | (:print-function print-function)

Arguments
slot-description
A defstruct slot description.
name
A symbol.
superclass
A symbol.
print-function
A symbol or a lambda expression.
Values
name
The name of the structure class.
Description

The macro def-kb-struct defines a KnowledgeWorks structure class name name. Objects of these classes are analogous to Lisp structures except that they may be used in rules similarly to CLOS objects.

If superclass is supplied then name will inherit from superclass, which must be KnowledgeWorks structure class.

print-function and slot-description are used as in defstruct.

Examples
(def-kb-struct start)
(def-kb-struct (named-kb-struct
  (:print-function print-named-kb-struct))
  (name (gensym 'named-kb-struct)))
(def-kb-struct (possible-trucks-for-load
  (:include named-kb-struct))
  load trucks)
See also

def-kb-class


KnowledgeWorks and Prolog User Guide (Macintosh version) - 01 Dec 2021 19:35:35