What's going on in the interaction with SBCL REPL below (the last form)?
TEST> (acons 'k 'v1 nil)
((K . V1))
TEST> (assoc 'k *)
(K . V1)
TEST> (push 'v2 (cdr *))
(V2 . V1)
TEST> (cdr '(K . V1))
(V2 . V1)
This is a bug, I guess?
What's going on in the interaction with SBCL REPL below (the last form)?
TEST> (acons 'k 'v1 nil)
((K . V1))
TEST> (assoc 'k *)
(K . V1)
TEST> (push 'v2 (cdr *))
(V2 . V1)
TEST> (cdr '(K . V1))
(V2 . V1)
This is a bug, I guess?
Copyright © 2021 Jogjafile Inc.
One possible interaction problem might be caused by using presentations in SLIME.
I'm using SLIME and SBCL.
So, I can get the same result as you. Strange, isn't it? But there might be an explanation for it. What did I do?
First: SLIME can use presentations and not just textual data. A presentation is a textual representation of the actual data. The text then is still linked to the underlying data.
I'm typing:
(acons 'k 'v1 nil)SLIME presents the result list:
I'm typing:
(assoc 'k *)SLIME presents the result list:
I'm typing:
(push 'v2 (cdr *))SLIME presents the result list:
Now it gets interesting. I'm typing
(cdr 'and then I'm copying the presentation(K . V1)from above by copy/paste. I'm not typing the list, I'm copying it. Then I type).The underlying data of the presentation has changed. SLIME tells SBCL to evaluate
(cdr '(K V2 . V1)). SLIME uses the value of the presentation, not it's actually displayed characters.Thus the result is:
Next, we can see the actual changed presentation's value: I'm writing a quote character first, then I again copy the
(K . V1)presentation from above.The result above shows that what you see is not what you get.