Lisp accessors for PL-ITERATOR values.
Thomas Russ <[email protected]> Tue, 6 Nov 2007 15:50:55 -0800
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
Just to close out this discussion, since there was a wrinkle I had
forgotten about:
PowerLoom's lisp translation comes in two versions, one which uses
CLOS objects to implement the Stella/PowerLoom objects and one which
uses structs (defstruct) instead. The default release uses structs
for speed. But the accessors for slots look different in the CLOS
and the STRUCT version.
In the CLOS version, values from Pl-iterator are accessed using the
generic function "%value", which works for all iterators and is
always in the STELLA package.
In the Struct version, values from Pl-iterator are accessed using the
function "%pl-iterator.value" in the PLI package, which works only on
pl-iterators. Other iterators have their own, specially qualified
names that are used to get the values, generally in the STELLA package.
So that means that if you write lisp code to manipulate pl-iterators,
you need to be aware of this distinction. For the more common Struct
case, you could iterator through all concepts by doing something like:
(let ((iter (pli:s-retrieve "all (concept ?x)" "PL-USER" null)))
(loop while (stella::next? iter)
do (print (pli::%pl-iterator.value iter))))