I'm confused by what you're saying here - these are examples of passing a 
map, not of passing varargs.

If you want to pass a map, you'll need a set up like:

(defmulti test-html :language)    ;; :language here is a keyword being used 
as a function of one arg (the map)

(defmethod test-html :html [the-map]
  (str (:data the-map) " will be transformed into html"))

(defmethod test-html :java-fx [the-map]
  (str (:data the-map) " will be transformed into javafx"))

Invoked like:

(test-html {:language :html :data "hello"})


On Wednesday, January 11, 2017 at 4:56:47 PM UTC-6, david swift wrote:
>
> Just lastly, I've seen people use the following structure of data
> (def test-html {:language ::html :data "hello"})
> and passing it as an argument to the mutlimethod, though not sure if it 
> would or could apply to my case but when I use it simply returns nil under 
> this condition
> (transform test-html)
>
> But I can do the following and produce a correct output, again not sure if 
> it's to do my approach or not, or even if varargs doesn't allow it…
> (transform {:language :html} "hello")
>
>

-- 
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/d/optout.

Reply via email to