On Feb 22, 2:54 pm, Mirko <mirko.vuko...@gmail.com> wrote:

>
> In lisp you would define it as (untested):
>
> (defmacro print-times (reps text)
> `(do-times (i ,reps)
> (print ,text))
>
> (Not trying to force-feed lisp, just that I do not know the closure
> syntax).

user=> (defmacro repeat-times [n & body]
            `(dotimes [placeholder# ~n]
                      ~...@body))
#'user/repeat-times
user=> (repeat-times 3 (println "hello!"))
hello!
hello!
hello!
nil
user=>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to