- #1
Xezlec
- 318
- 0
First off, I'm using Emacs 22.1.1 on SuSE 10.3 64-bit.
Now, the thing I've discovered is that in Emacs Lisp, if I do a C-x C-e on this:
and then on (annoy), I get "dolphin", as expected. But then if I do (annoy) again, I get "dolphindolphin" and so on. It keeps building up. Apparently the (let ((glorp '("")))) doesn't clear out glorp, and fails to make it truly local? Or (possibly more likely), that sets glorp to actually point to the list in the code right there, so changing it changes the actual damn code in the function? This makes me upset. Does anyone know what's going on here, and whether this is considered a bug or by design, and (most importantly) how to fix it?
Thanks!
Now, the thing I've discovered is that in Emacs Lisp, if I do a C-x C-e on this:
Code:
(defun annoy ()
(let ((glorp '("")))
(setcar glorp (concat (car glorp) "dolphin"))
(car glorp)))
and then on (annoy), I get "dolphin", as expected. But then if I do (annoy) again, I get "dolphindolphin" and so on. It keeps building up. Apparently the (let ((glorp '("")))) doesn't clear out glorp, and fails to make it truly local? Or (possibly more likely), that sets glorp to actually point to the list in the code right there, so changing it changes the actual damn code in the function? This makes me upset. Does anyone know what's going on here, and whether this is considered a bug or by design, and (most importantly) how to fix it?
Thanks!