Thomas Christian Chust wrote:
> [...]
> Additionally I suggest the following handy output and accumulator
> interfaces:
> [...]
I forgot to suggest the following algorithm:
;;; Map vectors to an equal size mutable vector.
(define (%v-map->%mv v mv)
(let ((v-length (%v-length v))
(v-ref (%v-ref v))
(make-mv (make-%mv mv))
(mv-set! (%mv-set! mv))
(list->min (%i->%a i=list a=min)))
(lambda (proc . vs)
(let ((min-length (list->min (map v-length vs))))
(do ((mvec (make-mv min-length))
(i 0 (fx+ i 1)))
((>= i min-length) mvec)
(mv-set! mvec i (apply proc (map (cut v-ref <> i) vs))))))))
cu,
Thomas
--
Murphy's Law is recursive. Washing your car to make it rain doesn't work.
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users