On Feb 6, 10:06 am, David Nolen <[email protected]> wrote:
> Is there anything in core or contrib for parsing arguments to a
> function? Since Clojure fns don't support optional args or even keyword
> args, is there a standard set of helpers functions to do this? I looked
> around but I didn't see anything obvious.
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).
-Stuart Sierra
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---