[racket] "variadic"nested for?
To add to prior query - here's what I did, but I just think there *must* be
a more elegant solution.
(define (nestfor depth forclause todo)
(define (nf depth forclause todo resultant)
(for ((x forclause))
(if (= depth 1)
(apply todo (append (list x) resultant))
(nf (- depth 1) forclause todo (append (list x) resultant)))))
(nf depth forclause todo empty))
(define (nestfortest . args) (displayln args))
(nestfor 3 '(1 2) nestfortest)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120313/20bbe762/attachment.html>