Stuart Sierra a écrit :
> No, but there is a pattern for keyword args:
>
> (defn my-function [& args]
> (let [options (apply hash-map args)]
> ...))
>
> Then you can call (my-function :keyword value :keyword2 value)
And you can use destructuring to add support for defaults value:
(defn my-function [& args]
(let [{:keys [option1 option2] :or {option1 "default1" option2 "default2"}}
(apply hash-map args)]
...))
Christophe
--
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---