[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Something out for which to watch
- To: clisp-list, email@example.com
- Subject: Re: Something out for which to watch
- From: haible (Bruno Haible)
- Date: Sun, 2 May 93 15:36:54 +0200
[This message is from David Loewenstern <firstname.lastname@example.org>.]
.. On Sat, 1 May 93 21:33:45 +0200, Peter Dudey <email@example.com> said:
} If you use a function like this:
} (defun foo (x) (delete x '(a b c d e f)))
} the quoted list '(a b c d e f) is NOT immune to the delete! Running the
} function could actually change it!
Yes. I'm fairly certain that CLtL2 makes this trap specific.
} I'm not sure if this is a bug in CLISP or not--I was under the impression
} that a quoted, explicit list like that was a constant, and would be
} "re-created" every time the function was run.
It isn't. I know Allegro and Symbolics CL show the same behavior.
It would be pretty space-inefficient to have the compiler force every
constant list (or array, or structure, I presume?) to be recopied
every time it was used. I shudder to think that every construct that
((a b c d e f g h i) (foo x))
((j k l) (bar x)))
really disguises a huge amount of consing, since typically CASE is
implemented as expanding into MEMBER tests:
(LET ((#:G0001 x))
(COND ((MEMBER #:G0001 '(a b c d e f g h i)) (foo x))
((MEMBER #:G0001 '(j k l))) (bar x)))
:NAME "David Loewenstern"
:LOCATIONS '((INTERNET "firstname.lastname@example.org")
:AFFILIATIONS '("AT&T Bell Labs" "Rutgers, Dept of CS")
:SILLY-QUOTE (UNIX:SHELL "/usr/bin/fortune"))))