[rucksack-devel] indexing issue?

Cyrus Harmon ch-rucksack at bobobeach.com
Thu Nov 30 17:50:13 UTC 2006


Thanks! This works now. But that leads to my next question... What is  
the intended behavior of a unique slot? I'm able to make-instance new  
instances of a persistent class with a duplicate slot value, which  
seems fine. I'm even able to add-rucksack-root these instances. When  
I try to rucksack-map-slot over the index with the uniqueness  
constraint, I get a subset of the objects, containing unique slots.  
When I map over the same data with a slot without a :unique  
constraint, I get all of the objects. It seems a bit odd that you get  
different results depending on the index. I would expect the index to  
provide an ordering and an efficient lookup method, but not to change  
the results. Should the add-rucksack-root be failing in this case or  
am I missing something about how this works?

here's a test using my previous example:

(defun test-unique-index ()
   (with-rucksack (rucksack *test-suite*)
     (with-transaction ()
       (rucksack-map-slot rucksack 'person 'beer #'print))))

(defun test-non-unique-index ()
   (with-rucksack (rucksack *test-suite*)
     (with-transaction ()
       (rucksack-map-slot rucksack 'person 'name #'print))))

RUCKSACK-OBJECT-TEST> (test-unique-index)

#<PERSON called "Martin" of age 9 who is Tired>
#<PERSON called "James" of age 8 who is Bored>
#<PERSON called "Arthur" of age 7 who is Sad>
#<PERSON called "Jans" of age 6 who is Sad>

RUCKSACK-OBJECT-TEST> (test-non-unique-index)

#<PERSON called "Arthur" of age 7 who is Sad>
#<PERSON called "Arthur" of age 1 who is Sad>
#<PERSON called "Arthur" of age 9 who is Mad>
...

Thanks again!

Cyrus


On Nov 30, 2006, at 2:52 AM, Arthur Lemmens wrote:

> Cyrus Harmon wrote:
>
>> Ah, it's not the symbol that's the issue, it's that I can't do
>> rucksack-map-slot unless :unique is t. I assume this should work for
>> non-unique indices as well?
>
> Yes, it should but it didn't ;-)
>
> The combination of an EQUAL parameter and non-unique keys wasn't
> handled correctly by MAP-INDEX-DATA.  The bug fix is in CVS now
> (along with a fix for the FLET instead of LABELS bug that you
> reported two weeks ago).
>
> Thanks very much for the bug report.
>
> Arthur
>




More information about the rucksack-devel mailing list