I think I see the goal now: to allow calling with either a map or sequential 
key-value pairs.

What you have appears correct and minimal for that purpose.

For a function taking a sequence, you can accomplish something similar without 
a second arity by choosing to call directly or call using apply. For a map the 
apply case isn't as simple.

Given:

        (defn blah
         [& {:as blah-map}]
         ;; do stuff with blah-map)

        (def m {:1 :2 :3 :4})

To call it "apply-style" with a map, you could use:

        (apply blah (reduce concat m))

--Steve

On Oct 10, 2010, at 12:39 AM, Grayswx wrote:

> Recently, I've been coding functions that take a map as follows.  I
> feel like it is slightly messy, though, and was wondering if any one
> else could think of a reason not to do it:
> 
> (defn blah
>  ([blah-map]
>    ;; do stuff with blah-map)
>  ([key val & {:as blah-map}]
>    (blah (assoc blah-map key val))))

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