Both of these are much easier when passing an explicit map. Any preferences here, from either writing or using APIs like this?
Cheers,
Colin
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I still think the keyword argument approach is far more readable to _users_
--
I especially dislike that my non-kwarg fns no-longer can elegantly accept no options. Let me illustrate:(defn foo [& {:keys [a b]}][a b])(foo :a 1 :b 2)(foo)
--
It's not obvious to me why the "bad" release-sharks example on the coding standards page [1] is bad. Why should the optional config be the "least variance argument"?I had to look up "laudable", btw. It's one of those good words that sounds bad. :)
--
--
user> (defn a [& {x :x y :y}] (vector x y))
#'user/a
user> (a :y 7 :x 3)
[3 7]
user> (apply a {:x 3 :y 7})
[nil nil]
It's been a while since I've tested this, but I believe that if a map is passed as the last argument to apply, Clojure "does the right thing" and passes the map in as keyword args.
--
Yep: that won't override the arg if the caller passes it to you as well.