fi [Macro]


Purpose

The fi macro performs an exhaustive search for the instance having a specified identifier. It should be used interactively rather than in application code because it is much slower than get-instance or find-instance.

Syntax

fi datum &key context

Arguments

The datum argument is a Lisp expression. It may be an extended identifier having the form context\^{\space}identifier, 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 instance 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 instance identified by that symbol. If this fails, or if datum is a list, Loom evaluates datum and searches for the instance 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 instance having the specified identifier, or nil if none was found, (2) the context in which the instance was found, or nil if no instance was found.

Remarks

This is the most thorough and flexible of the functions for accessing Loom instances, but it is also the slowest. Because datum may be evaluated at compile time, fi cannot be reliably used in application code.

Examples

(fi Joe) ==> |I|JOE |TH|CL-USER-THEORY 
(fi Thing) ==> |C|THING |TH|BUILT-IN-THEORY 
(fi cl-user-theory\^{\space}Los-Angeles) ==> |I|LOS-ANGELES |TH|CL-USER-THEORY  
(fi Los* :context bottom-theory) ==> |I|LOS-ANGELES |TH|CL-USER-THEORY 
(setq instances '(Joe Fred))    
(fi (second instances)) ==> |I|FRED |TH|CL-USER-THEORY

See Also

Last modified: Jun 1 1995