Consider:

user=> (defn foo [ {:keys [a b] :or {c 5}} ]
                     (list a b))
#'user/foo

Note that the key of the default entry for "c" is not in the formal
parameter list.

user=> (foo 7)
(nil nil)
user=> (foo {:a 3 :b 4})
(3 4)
user=> (foo {:a 3 :c 4})
(3 nil)

The second is of course correct. The last form's behaviour seems
reasonable, assuming that the defn will not be flagged as a compiler
error due to a mismatch with the list of formal parameters.

The first seems troublesome under any set of assumptions I can come up
with. I would expect either a map parameter (for use with param names)
or a two actual parameters (to bind by position with the formal params
in the [a b] list, in case I didn't want to use the named params).
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to