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

The reason series test 251 fails in KCL

Test 251 does not work in akcl 530 because KCL's implementation of SUBST 
does more than the minimal amount of consing.  KCL's SUBST is compatible
with CLtL.  A fix for test 251 is to define:

(lisp:defun subst-min (new old tree)
  (if (eql old tree)			; test
      (if (not (consp tree))
	  (lisp:let* ((car (car tree))
		      (cdr (cdr tree))
		      (scar (subst-min new old car))
		      (scdr (subst-min new old cdr)))
	    (if (and (eql car scar) (eql cdr scdr))
		(cons scar scdr))))))

and to change the :optimizer for defS alter to use subst-min instead of
subst.  Perhaps other uses of subst should be changed as well.  On the other 
hand, maybe there is some better way to fix the :optimizer for alter.

If these two changes are made, and the definition of subst-min is changed to
(lisp:defun subst-min (new old tree)
  (nsubst new old (copy-tree tree)))
(also a legal definition for SUBST, according to CLtL), then test 251 fails 
in Lucid's lisp in the same way that it (originally) failed in KCL.

With these two changes, both akcl 530 and lucid Lisp passed all of the 549 tests. 
(I set the variable *compile-tests* to nil so that I wouldn't have to wait hours 
for the tests to complete.)

  Richard Harris

test 251:
;this contains tests of the various special forms supported.
    ((let* ((lst (list 'a 'b 'c))
	    (l (scan-sublists lst))
	    (e (to-alter (#Mcar l)
			 #'(lambda (new parent)
			     (rplaca parent new))
       (list (collect e)
	     (alter e (#Mlist e))
	     (collect e)
     ((a b c) nil (a b c) ((a) (b) (c))))
;;; Sun Common Lisp, Development Environment 3.0.0, 27 October 1988
;;; Sun-4 Version for SunOS 3.2 
;;; Copyright (c) 1985, 1986, 1987, 1988 by Sun Microsystems, Inc., All Rights Reserved
;;; Copyright (c) 1985, 1986, 1987, 1988 by Lucid, Inc., All Rights Reserved
;;; This software product contains confidential and trade secret
;;; information belonging to Sun Microsystems.  It may not be copied
;;; for any reason other than for archival and backup purposes.
;;; This image contains the Compiler (production and development modes),
;;; the Window Tool Kit, Flavors, and the Editor.

> (setq x '(a b c))
(A B C)
> (setq *print-circle* t)
> (list x (subst 'z 'b x))
((A B . #1=(C)) (A Z . #1#))


AKCL (Austin Kyoto Common Lisp)  Version(1.530) Tue Jan 22 14:12:50 EST 1991
Contains Enhancements by W. Schelter
Changes in version 1-455 definitely require recompilation of user files.

>(setq x '(a b c))
(A B C)

>(setq *print-circle* t)

>(list x (subst 'z 'b x))
((A B C) (A Z C))

>(list x (list* 'a 'z (cddr x)))
((A B . #0=(C)) (A Z . #0#))