fr [Macro]
Purpose
The fr macro performs an exhaustive search for the relation having a specified name. It should be used interactively rather than in application code because it is much slower than get-relation or find-relation.
Syntax
fr datum &key context
Arguments
The datum argument is a Lisp expression. It may be an extended identifier having the form context\^{\space}name, where context is the context from which the search starts. It may also be an identifier beginning and/or ending with the wildcard character *, in which case the search proceeds until the first matching relation is found. It is not necessary to specify the package in which datum resides since the search is package-independent. If datum is a symbol, Loom first tries to locate the relation named by that symbol. If this fails, or if datum is a list, Loom evaluates datum and searches for the relation corresponding to the resulting value.
The context argument is the name of a context, or a form which evaluates to a context or context name. This argument defaults to the current context.
Value
Two values are returned: (1) the relation having the specified name, or nil if none was found, (2) the context in which the relation was found, or nil if no relation was found.
Remarks
This is the most thorough and flexible of the functions for accessing Loom relations, but it is also the slowest. Because datum may be evaluated at compile time, fr cannot be reliably used in application code.
Examples
(fr binary-tuple) ==> |R|BINARY-TUPLE |TH|BUILT-IN-THEORY
(fr user-kb\^{\space}roundtrip-fare) ==> |R|ROUNDTRIP-FARE |TH|CL-USER-THEORY
(fr *trip* :kb bottom-kb) ==> |R|ROUNDTRIP-FARE |TH|CL-USER-THEORY
(setq relations '(height weight))
(fr (first relations)) ==> |R|HEIGHT |TH|CL-USER-THEORY
See Also
Last modified: Jun 1 1995