On Nov 24, 6:19 pm, Justin Giancola <[EMAIL PROTECTED]> wrote:
> So, you need to evaluate all of the args independently when building
> the list literals, possibly with:
> (defmacro stub [stubs & body]
>   (let [stub-maps
>         (reduce (fn [acc [[f & args] res]]
>                   (assoc-in acc [f `(list [EMAIL PROTECTED])] res))
>                 {}
>                 (partition 2 stubs))]
>     `(binding
>          [~@(mapcat (fn [[fname fhash]]
>                       `(~fname (fn [& args#] (~fhash args#))))
>                     stub-maps)]
>       [EMAIL PROTECTED])))
>
> I'm not sure this is quite as easy to follow, but I'd prefer to avoid
> proxying all of the arg lists through vectors just because they're
> self-evaluating.

Thanks for the suggested improvements! It took me a while to find the
time to code, but I've now integrated the improved stub macro into my
own code, with the lambdas bound to names via 'let' for clarity.

- James
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to