[plt-scheme] for-each in vector (macro)

From: François Michaudon (f.michaudon at gmail.com)
Date: Sun Apr 26 10:50:31 EDT 2009

Hello,
(define-syntax for-each-vector
  (syntax-rules ()
    ((for-each-vector proc vec) (let ((len (vector-length
vec)))
                                     (do ((index 0 (+ index 1)))
                                       ((= index len))
                                       (proc (vector-ref vec index)))))))
Now examples:
(for-each-vector (lambda (a) (display a)) #( 1 2 3))

>>> 123 ok

(for-each-vector (lambda (a b) (display (+ a b))) #( 1 2 3)  #( 1 2 3))

>>> error syntax

I try to put some ... in my define doesn't work.
How to use multiple args in lambda ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090426/5d98f55a/attachment.html>

Posted on the users mailing list.