[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SEQUENCE-FUNCTIONS-EXCLUDE-ARRAYS (Version 3)
- To: Masinter.pa@Xerox.COM
- Subject: Re: SEQUENCE-FUNCTIONS-EXCLUDE-ARRAYS (Version 3)
- From: Pedersen.pa@Xerox.COM
- Date: 26 Oct 87 19:30 PDT
- Cc: CL-Cleanup@SAIL.STANFORD.EDU, Pedersen.pa@Xerox.COM
- In-reply-to: Masinter.pa's message of 26 Oct 87 16:27 PST
"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.