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 does the splicing that I want.

Razvan

On Dec 17, 6:32 pm, Razvan Rotaru <razvan.rot...@gmail.com> wrote:
> Great. Thanks.
>
> On Dec 17, 6:08 pm, Baishampayan Ghose <b.gh...@gmail.com> 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" ...}]])
>
> > > (html [:head (get-header) ...] [:body ...])
>
> > > The result of get-header needs to "spliced" into the rest of the
> > > structure for the html macro to work.
>
> > You can use either `apply` or `into` here -
>
> > (apply vector :head (get-header))
>
> > (into [:head] (get-header))
>
> > Regards,
> > BG
>
> > --
> > Baishampayan Ghose
> > b.ghose at gmail.com

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