> 4) Is there not a way to define a function with one argument, and have
> that argument be optional? or have only optional arguments?

; all args optional
(defn arg-count [& args] (count args))

; custom handling for different arg counts
(defn arg-opinion
   ([] "that will be easy to test!")
   ([a] "keeping it simple")
   ([a b] "things have to interact with other things sometimes")
   ([a b c] "three's a crowd!")
   ([a b c & d] "Come on, that's too many args!"))

Cheers,
Stuart


--~--~---------~--~----~------------~-------~--~----~
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