On 03/06/13 19:04, Alice wrote:
It's more readable.
(my-widget {:id "id1"} "hello" "world")
you can get to almost exactly that with the last variant I posted.
(defn my-widget
([attrs contents] (apply widget-creator attrs contents)) ;;I have no idea
what widget-creator might be
([contents] (my-widget {} contents))
([] (my-widget {} []))
Basically, it becomes:
(my-widget {:id "id1"} ["hello" "world"]) ;;notice the extra vector
of course, then you need to use 'apply' on the contents if the fn you're
eventually calling expects variadic args (from hiccup I guess).
(apply hiccup/widget* attrs contents)
Jim
--
--
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
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.