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

Re: fixing our problems with setf



A nit in your test case.  It would be nicer if the optional variable end
had a default value rather than using the (unless end ...) hack:

;If setf of subseq was not already built into Common Lisp,
;it could have been defined like this
(defun (setf subseq) (new-value sequence start &optional (end (length
sequence)))
  (setq end (min end (+ start (length new-value))))
  (do ((i start (1+ i))
       (j 0 (1+ j)))
      ((= i end) new-value)
    (setf (elt sequence i) (elt new-value j))))