[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: bug-lisp at MIT-MC
- From: Rod Brooks <ROD at SU-AI>
- Date: Mon, 8 Dec 80 07:09:00 GMT
- Original-date: 07 Dec 1980 2309-PST
SUBST definition changed?
This happens at SAIL and MC:
(setq x '(a b))
(setq y '(a b))
(eq x y)
(subst 'foo x (list y y y))
(FOO FOO FOO)
Whereas the online definition (at SAIL) for SUBST is:
(subst x y z) substitutes x for all occurrences of y in z, and returns the
modified copy of z. The original z is unchanged, as subst recursively
copies all of z replacing elements eq to y as it goes. If x and y are nil,
z is just copied, which is a convenient way to copy arbitrary list
subst could have been defined by:
(defun subst (x y z)
(cond ((eq z y) x) ;if item eq to y, replace.
((atom z) z) ;if no substructure, return arg.
((cons (subst x y (car z)) ;otherwise recurse.
(subst x y (cdr z))))))
Is this change "official" or accidental (i.e. will it stay this way, or might
it change back)?