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

Re: SEQUENCE-FUNCTIONS-EXCLUDE-ARRAYS (Version 3)



"Note that simply extending COERCE, MAKE-SEQUENCE, LENGTH, 	ELT, and the
SETF expander for ELT would have the side effect of extending the
remaining functions if they are written in the obvious way.

For example:
  
(DEFUN SUBSTITUTE (NEW-ITEM OLD-ITEM SEQUENCE &KEY ...)
    (LET ((RESULT (MAKE-SEQUENCE (TYPE-OF SEQUENCE))))
     (DOTIMES (I (LENGTH SEQUENCE) RESULT)
	 (SETF (ELT RESULT I)
	       (IF (EQL (ELT SEQUENCE I) OLD-ITEM) 
	 	   NEW-ITEM
		   (ELT SEQUENCE I))))))"

I think this argument is a canard since any implementation worth its
salt will type dispatch for all sequence functions. The :generalize
proposal will inescapably induce a large number of small changes to
existing Common Lisp implementations.

It seems more esthetic to localize those changes in a single extension
(eg. (coerce x 'sequence))  rather than spreading them all over the
sequence functions.

							J.P.