[rucksack-devel] indexing issue?

Arthur Lemmens alemmens at xs4all.nl
Thu Nov 30 19:13:03 UTC 2006


Attila Lendvai wrote:

>> (My guess is that this should be pretty easy, and you may want to try
>> this yourself.  Probably adding an :ERROR keyword argument to the right
>> call to BTREE-INSERT will do the trick.)
>
> in such sutuations i usually add a :when-exists keyword arg with type
> (or function (member :error :warn ...)) and when a lambda is passed
> then (funcall it object).

Yeah, I did it slightly differently.  Here's the doc string for BTREE-INSERT:

(defgeneric btree-insert (btree key value &key if-exists)
   (:documentation
    "Adds an association from KEY to VALUE to a btree.

IF-EXISTS can be either :OVERWRITE (default) or :ERROR.

If the btree has unique keys (see BTREE-UNIQUE-KEYS-P) and KEY is
already associated with another (according to BTREE-VALUE=) value, the
result depends on the IF-EXISTS option: if IF-EXISTS is :OVERWRITE,
the old value is overwriten; if IF-EXISTS is :ERROR, a
BTREE-KEY-ALREADY-PRESENT-ERROR is signaled.

For btrees with non-unique keys, the IF-EXISTS option is ignored and
VALUE is just added to the list of values associated with KEY (unless
VALUE is already associated with KEY; in that case nothing
happens)."))

Arthur







More information about the rucksack-devel mailing list