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

[no subject]

SUBST definition changed?
This happens at SAIL and MC:

(setq x '(a b))
(A B) 
(setq y '(a b))
(A B) 
(eq x y)
(subst 'foo x (list y y y))

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)?