[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Something out for which to watch



[This message is from David Loewenstern <loewenst@paul.rutgers.edu>.]

.. On Sat, 1 May 93 21:33:45 +0200, Peter Dudey <pdudey@jupiter.willamette.edu> 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
looks like 
(CASE x 
  ((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)))

---
(WITH-STANDARD-DISCLAIMERS
   (MAKE-INSTANCE 'Signature
         :NAME      "David Loewenstern"
         :LOCATIONS '((INTERNET "davel@homxc.att.com")
                      (INTERNET "loewenst@paul.rutgers.edu")
                      (AT&T "201-386-6516"))
	 :AFFILIATIONS '("AT&T Bell Labs" "Rutgers, Dept of CS")
         :SILLY-QUOTE (UNIX:SHELL "/usr/bin/fortune"))))