[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How does letf work?
From: |
Florian Beck |
Subject: |
How does letf work? |
Date: |
Wed, 29 Jan 2014 00:10:00 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
The docstring of letf says: "This is the analogue of `let', but with
generalized variables (in the sense of `setf') for the PLACEs."
However, with setf, I get this:
(defvar test-x '(KEY 1 2 3 4))
(let ((x (copy-list test-x)))
(setf (cdr x) '(a b c d))
x)
=> (KEY a b c d)
(Without copy-list, the global variable is modified.)
Yet this doesn't work with letf:
(letf (((cdr test-x) '(a b c d)))
test-x)
= > (KEY 1 2 3 4)
So, either "generalized variables" in the sense of setf are different
from the sense of letf or -- more likely -- I don't understand how they
work. Any hints?
--
Florian