I won't answer the question about R5RS, but in Racket you can do this
fairly succinctly:
#lang racket/base
(require (for-syntax racket/base
racket/syntax))
(define-syntax (vars stx)
(syntax-case stx ()
[(_ id count val)
(with-syntax
([(id_i ...)
(for/list ([i (in-range 1 (add1 (syntax->datum #'count)))])
(format-id #'id "~a~a" #'id i))])
(syntax/loc stx
(begin (define id_i val)
...)))]))
(vars id 5 null)
(vector id1 id2 id3 id4 id5)
2014-09-24 22:35 GMT-04:00 Alejandro Zamora <[email protected]>:
> Hi Racket people:
> I have a (maybe too simple) question:
> How I create one macro like this (but using define-macro &
> R5RS language only)?:
>
> (vars sym var-cant val-of-vars)
>
> Example:
> (vars id 5 null) -> (prog (define id1 null)
> (define id2 null)
> (define id3 null)
> (define id4 null)
> (define id5 null))
>
> --
> Nunca digas nunca, di mejor: gracias, permiso, disculpe.
>
> Este mensaje le ha llegado mediante el servicio de correo electronico que
> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema
> Nacional de Salud. La persona que envia este correo asume el compromiso de
> usar el servicio a tales fines y cumplir con las regulaciones establecidas
>
> Infomed: http://www.sld.cu/
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
--
Jay McCarthy
http://jeapostrophe.github.io
"Wherefore, be not weary in well-doing,
for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
- D&C 64:33
____________________
Racket Users list:
http://lists.racket-lang.org/users