[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does letf work?
From: |
Michael Heerdegen |
Subject: |
Re: How does letf work? |
Date: |
Thu, 30 Jan 2014 00:53:43 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Joost Kremers <joost.m.kremers@gmail.com> writes:
> (letf (((cdr test-x) '(a b c d)))
> (cdr test-x))
>
> = > (KEY a b c d)
>
> Taking what you say at face value, one might expect that at the moment
> the value of (cdr test-x) is printed, it's already been changed back to
> the original value, so it should say (KEY 1 2 3 4), but it doesn't.
(cdr test-x) here references an object being a list equal to '(a b c d).
But after the letf has been left, that object is not anymore the cdr of
test-x, because its cdr has been restored. But that doesn't make the
return value "switch" to a different object.
The analogy with boxes is very helpful here.
Michael.