Hm I tried to respond to this just now but I think I accidentally deleted 
my post, or at least I hope so and I wasn't breaking some etiquette and 
being modded.

The snippets macro expands into a map literal, and the snippet function 
will be executed at macro expansion time. You can see this by calling 
macroexpand from Clojure (in the ClojureScript One repl, with the classpath 
set up properly):

one.sample.repl=> (require '[one.sample.snippets])
nil
one.sample.repl=> (macroexpand '(one.sample.snippets/snippets))
{:form "<div id=\"form\">\n ..." :greeting "<div id=\"greeting\">\n ..." }

Hope that helps,
Aki

On Thursday, April 5, 2012 4:19:22 PM UTC-4, Duraid wrote:
>
> In this doc (
> https://github.com/brentonashworth/one/wiki/Design-and-templating) under 
> 'Including templates in the application' it says:
>
> * In ClojureScript, macros are Clojure macros and run only at compile 
> time. This means we can use any Clojure library from a macro. *
> *
> *
> The way I understand it is that in clojure macros get expanded before 
> evaluation. How is that different in ClojureScript?
>
> So in the the example from the document, the snippets macro will be 
> expanded and include a call to the snippet function that will be called at 
> runtime which in turn calls the enlive library which is a clojure library. 
> So how does that work?
>
> Thanks
>

-- 
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