Algernon normally treats a value *b* in the slot *p* of a frame *a* as
an abbreviation for the logical predicate *p*(*a*,*b*). However, there
are times when it is useful to have the list of values `(
... )` in a given Algernon slot.

In the following, we obtain the list of Adam's children in order to print it out.

(ask '((:bind ?kids (:values Adam child)) (:eval (format t "~%Adam's children are ~a." '?kids))) :comment ":BIND the list of values in a slot.") QUERYING: :BIND the list of values in a slot. Adam's children are (ELLEN DONNA CHARLES). Result: Binding: ?kids --- (ellen "[ellen]" donna "[donna]" charles "[charles]") => T

We can also obtain the list of values in a slot to pass it to a Lisp function to compute some other value, in this case, the number of elements.

(ask '((:bind ?n (:funcall #'length (:values Adam child))) (:eval (format t "~%Adam has ~a children." '?n))) :collect '(Adam has ?n children) :comment ":BIND and :FUNCALL evaluate a Lisp function") QUERYING: :BIND and :FUNCALL evaluate a Lisp function Adam has 3 children. Result: Binding: ?n --- 3 => ((ADAM HAS 3 CHILDREN))

Tue Oct 29 10:54:13 CST 1996