On Mon, Mar 15, 2010 at 3:56 AM, wilig <will.gro...@gmail.com> wrote:

> Thanks David,
>
> As a new clojurian, this is extremely helpful!  I have a question.  In
> this function:
>
> (html/deftemplate index "tutorial/template1.html"
>  [ctxt]
>  [:p#message] #(if-let [msg (or (:message ctxt)
>                                 "Nothing to see here!")]
>                  ((html/content msg) %)))
>
> Isn't if-let redundant?
>

Wow thanks for pointing that out. Turns out that section is way off! It can
be expressed like so:

(html/deftemplate index "tutorial/template1.html"
  [ctxt]
  [:p#message] (html/content (get ctxt :message "Nothing to set here"))

However this isn't the real point of (maybe-content ...). I've updated the
tutorial to clarify.

David

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