Don't you think
- fixed-order named parameters
could (should?) be a separate issue from
- optional, any-order, named parameters
?
;; :x :y are fixed order, named, while :a :b are optional, named
(defn foo [:x :y & {:keys [a b]] [x, y, a, b])
(foo :x 1 :y 2)
=> [1 2 nil nil]
(foo :x 1 :a 2)
=> error
(foo :x 1 :a 3 :y 2)
=> error
(foo :x 1 :y 2 :b 3)
=> [1 2 nil 3]
Note that
(defn foo
([:x & {:keys [y]] [x nil])
([:x :y] [x y]))
would create 2 function symbols e.g. foo:x and foo:x:y
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
To unsubscribe, reply using "remove me" as the subject.