Alex is exactly right, as pointed out by the docs. set-valued slots
partially solve this annoyance with persistent collections stored in
slots, but they are unordered.
Unfortunately aref is not a generic function so you'd have to play
package naming games to hijack it which I abhor. I'm open to
suggestions on ways to handle such an idiom, but nothing has come to
mind yet. A macro to create slot accessors that do all the
bookkeeping automatically might be useful as an option for users.
Ian
On Apr 29, 2008, at 3:24 PM, Alex Mizrahi wrote:
LPP> (32): (setf (aref (slot-value sch 'a) 2) 1)
LPP> 1
LPP> (33): (slot-value sch 'a)
LPP> #(0 0 0 0)
how do you thik it is supposed to work?
to my knowledge, elephant does not hijack (setf aref), so (setf
aref) just
modifies a temporary array returned by a slot read.
db is written _only_ on (setf slot-value), if you do not explicitly
write to
slot, value in database won't be updated.
it seems this stuff is in documentation:
----
2.7 Persistent collections
The remaining problem outlined in the section on Serialization is that
operations which mutate collection types do not have persistent side
effects. We have solved this problem for objects, but not for
collections
such as as arrays, hashes or lists. Elephant provides two solutions
to this
problem: the pset and btree classes. Each provides persistent
addition,
deletion and mutation of elements, but the pset is a simple data
structure
that may be more efficient in memory and time than the more general
btree.
----
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel