Sorry. Last line should read:

(defmacro bench [expr] `(bench-fn (fn [] ~expr)))

On Tue, Nov 9, 2010 at 1:06 PM, nicolas.o...@gmail.com
<nicolas.o...@gmail.com> wrote:
> If you want that, you don't need macro.
>
> (defn bench [f]
>  (let [start ...
>        result (f)] ; note the call to f
>     ....))
>
> But you would have to call it with:
>
> (bench #(expr)) or (bench (fn [] expr))
>
> You cannot do it directly because it would evaluate expr before the
> call to bench.
>
> This one of the usual use of macros: altering evaluation order.
> (bench, or, and....)
>
> Somehow, I think both are useful
>
> (defn bench-fn [f]....)
>
> (defmacro bench [expr] `(bench-fn ~expr))
>



-- 
Sent from an IBM Model M, 15 August 1989.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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