Hi list, I'm a little confused at a bug in my code.

I have this procedure 'rooms that returns some data:

: (rooms)
-> (("threshold" (("long-description" "You stand in front of a wooden
door, reputed to be the home of one Dr. Theobold. The door has a small
keyhole.") NIL NIL 1)) NIL NIL 1)

Now, if I run a command (another aa-search) on that data (copy and
pasted) I get the result I expect:

: (aa-search '(("threshold" (("long-description" "You stand in front of
a wooden door, reputed to be the home of one Dr. Theobold. The door has
a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold")
-> ("threshold" (("long-description" "You stand in front of a wooden
door, reputed to be the home of one Dr. Theobold. The door has a small
keyhole.") NIL NIL 1))

However, if I run this command, I get a different result:

: (aa-search (rooms) "threshold")
-> NIL

Q: Should not the results be the same?

Here are definitions of the various functions:

: (pp 'rooms)
(de rooms NIL
   (cadr (aa-search World "rooms")) )

: (pp 'aa-search)
(de aa-search (Tree Key)
   (unless (not Tree)
      (if (== Key (car (aa-kv Tree)))
         (aa-kv Tree)
         (if (< Key (car (aa-kv Tree)))
            (aa-search (aa-left Tree) Key)
            (aa-search (aa-right Tree) Key) ) ) ) )
-> aa-search


-- 
https://qlfiles.net
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to