Re: unquote-splicing when calling macro

2011-12-17 Thread Cedric Greevey
On Sat, Dec 17, 2011 at 11:08 AM, Baishampayan Ghose wrote: >> This may sound a bit weird, but can I "unquote-splice" something when >> calling a macro. Here's an attempt to do this with hiccup: >> >> (defn get-header >>   [[:link {:type "text/css" ...}] >>    [:script {:type "text/javascript" ...

Re: unquote-splicing when calling macro

2011-12-17 Thread Robert Marianski
On Sat, Dec 17, 2011 at 06:06:50AM -0800, Razvan Rotaru wrote: > Hi, > > This may sound a bit weird, but can I "unquote-splice" something when > calling a macro. Here's an attempt to do this with hiccup: > > (defn get-header >[[:link {:type "text/css" ...}] > [:script {:type "text/javascr

Re: unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
I just found out that it also works like this: (defn get-header (list [:link {:type "text/css" ...}] [:script {:type "text/javascript" ...}]]) (html [:head (get-header) ...] [:body ...]) They key here is not to return a vector. If the html macro encounters another kind of sequence, it

Re: unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
Great. Thanks. On Dec 17, 6:08 pm, Baishampayan Ghose wrote: > > This may sound a bit weird, but can I "unquote-splice" something when > > calling a macro. Here's an attempt to do this with hiccup: > > > (defn get-header > >   [[:link {:type "text/css" ...}] > >    [:script {:type "text/javascrip

Re: unquote-splicing when calling macro

2011-12-17 Thread Baishampayan Ghose
> This may sound a bit weird, but can I "unquote-splice" something when > calling a macro. Here's an attempt to do this with hiccup: > > (defn get-header >   [[:link {:type "text/css" ...}] >    [:script {:type "text/javascript" ...}]]) > > (html [:head (get-header) ...] [:body ...]) > > > The resu

unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
Hi, This may sound a bit weird, but can I "unquote-splice" something when calling a macro. Here's an attempt to do this with hiccup: (defn get-header [[:link {:type "text/css" ...}] [:script {:type "text/javascript" ...}]]) (html [:head (get-header) ...] [:body ...]) The result of get-h