with-features [Macro]
Purpose
The with-features macro effectively unsets all Loom features, sets only a specified group of features, executes a body of code, and then resets all features to their original values.
Syntax
with-features (&rest features) &body body
Arguments
The features argument is a Loom feature, or a list of Loom features, to be temporarily set. The following features are available:
- If the :ask-about-redefinitions feature is set, Loom checks with the user before redefining a concept. This feature is set by default.
- If the :ask-for-concept-names feature is set, Loom prompts the user for concept names whenever system-defined concepts are generated. The prompting is done after the new concepts have been completed. If the user declines to supply a name, the concept is assigned a system-generated name.
- If the :ask-for-names-immediately feature is set, Loom asks the user to name system-defined conjunction concepts as soon as they are created and classified.
- If the :automatic-clos-classes feature is set, a CLOS class is automatically created whenever make-object (or tell or create with the :clos flag set) is called to instantiate a concept that does not already have an associated CLOS class. If this feature is disabled, a CLOS class is not created unless the concept explicitly contains the :clos-class characteristic. The :automatic-clos-classes feature is set by default.
- If the :clip-roles feature is set, clipping is performed on all single-valued roles. That is, if two (or more) different instances are asserted to be fillers of a single-valued role, Loom automatically retracts all but the last assertion. This feature is set by default.
- If the :clip-types feature is set, clipping of instance types is enabled. That is, if an instance's type is asserted to contain two (or more) concepts which are disjoint, or would otherwise cause the instance to become incoherent, then Loom automatically retracts all but the last assertion.
- If the :display-match-changes feature is set, whenever a production memory match or instance classification occurs, Loom indicates which concepts have entered or exited the type of each affected instance, and which rete nodes the instance has entered or exited. This feature is set by default.
- If the :domain-implies-role feature is set when Loom creates a shadowing CLOS class for a concept C, then the new class will have slots corresponding to every relation whose domain is C.
- If the :dont-name-system-defined-concepts feature is set, Loom does not generate a name for system-defined concepts and relations (provided :ask-for-names-immediately is also enabled).
- If the :emit-classify-dots feature is set, a dot, minus, or plus is printed when a concept is classified, unclassified, or completed, respectively, and an exclamation point is printed when a concept is sealed (i.e., ready to participate in data manipulation operations). Also, the character M is printed when concepts merge during classification, U is printed when they unmerge, and C is printed when a CLOS class is created. This feature is set by default.
- If the :emit-match-stars feature is set, an asterisk is printed whenever the type of an instance changes. Also, Loom prints a T whenever a new type is created as a result of unifying a newly-matched concept with the concepts already in an instance's type. This feature is set by default.
- If the :expand-system-defined-print-names feature is set, the printed representation of an instance has the form |I|identifier(concepts), where concepts contains the names of the most-specific user-named concepts which the instance matches. If this feature is not set, type information is omitted from the printed representation of the instance.
- If the :prefer-clos-instances feature is set, Loom automatically creates a CLOS instance when tell or create is called. If there is no CLOS class corresponding to the concept being instantiated, Loom attempts to create one. If this effort fails, a standard Loom instance is created, and a warning is issued (unless the clos-instance-p argument to create was :no-warning).
- If the :suppress-diehard-output feature is set, all Loom informational and warning output is suppressed. For example, save-kb typeout, classify dots, type-change messages, and incoherence warnings are all inhibited. It is advisable to set this feature when loading very large knowledge bases because of the overhead associated with lengthy typeout (especially when running under Emacs).
- If the :warn-about-syntax-corrections feature is set, a warning is issued whenever a syntax error is detected in a concept definition or in a query. This feature is set by default.
- If the :warn-on-nonprimitive-clos-classes feature is set, a warning is issued whenever a CLOS class is created to shadow a non-primitive concept. This feature is set by default.
The body argument is one or more Lisp forms to be executed with the indicated feature settings.
Value
The with-features macro returns the value of the last form in body.
Remarks
The :open-world and :closed-world features cannot be temporarily set.
Examples
(with-features (:emit-match-stars :display-match-changes)
(do-this)
(do-that))
See Also
Last modified: Jun 1 1995