|
From: Geoffrey K. <ge...@kn...> - 2003-08-08 04:00:14
|
Let's say I have:
(define (stone-size)
(vector-ref stone-sizes
(.nextInt random-gen (vector-length stone-sizes))))
(define (stone-thickness)
(vector-ref stone-thicknesses
(.nextInt random-gen (vector-length stone-thicknesses))))
(define (caulking-type)
(vector-ref caulking-types
(.nextInt random-gen (vector-length caulking-types))))
Notice the repetition? How can I use a JScheme macro to write this
once? Ignore the fact that "es" pluralizes "thickness" while "s"
pluralizes "size" and "type."
Thanks,
Geoffrey
--
Geoffrey S. Knauth | http://knauth.org/gsk
|