|
From: Marco B. <em...@be...> - 2002-07-31 18:12:47
|
(assoc obj alist :test #'equal :test #'equal) was producing this
stack setup before calling the builtin assoc:
0: (FUNCTION EQUAL)
1: :TEST
2: unbound
3: unbound
4: (FUNCTION EQUAL)
5: ALIST
6: OBJ
while it should have be been producing:
0: unbound
1: unbound
2: (FUNCTION EQUAL)
3: ALIST
4: OBJ
this sent the assoc builtin crazy since it assume a nicely formatted
stack. basicaly: when we are compiling a funcall with keyword args we
shouldn't assume that each keyword appears only once.
what i don't understand is how come this works:
(defun foo (&key k) k)
(compile 'foo)
(defun call-foo () (foo :k 4 :k 5))
(compile 'call-foo)
(call-foo) => 4
if we go and disassemble call-foo we see that it pushes all elments
(:K,4,:K and 5) onto the stack and foo only pops one arg
off. somewhere someone is doing some arg processing that i don't
understand.
--
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
-Leonard Cohen
p.s. - since i don't totally understand what's going on, take this
patch with a grain of salt.
|