From: Dirk G. <di...@di...> - 2005-01-16 15:43:02
|
Hi, does anyone know what I'm doing wrong in the following code? I'm trying to make a scanner for a 3D vector data structure that supports alteration. As you can see the scanning works fine, but ALTER has no effect: > (defstruct vec x y z) VEC > (defun scan-vec (vec) (declare (optimizable-series-function)) (to-alter (make-series (vec-x vec) (vec-y vec) (vec-z vec)) #'(lambda (new-value index) (ecase index (0 (setf (vec-x vec) new-value)) (1 (setf (vec-x vec) new-value)) (2 (setf (vec-x vec) new-value)))) (scan-range :from 0))) SCAN-VEC > (collect (scan-vec (make-vec :x 1 :y 2 :z 3))) (1 2 3) > (let ((vec (make-vec :x 1 :y 2 :z 3))) (alter (scan-vec vec) (series 0)) vec) #S(VEC :X 1 :Y 2 :Z 3) ; <-- should be #S(VEC :X 0 :Y 0 :Z 0) I'm using the dev-lisp/cl-series-2.2.7 package in Gentoo Linux. This contains some patches of mine to make it work for SBCL, but I've also tried the above in CMUCL with the same results. Thanks in advance for any help. Kind regards, Dirk Gerrits |