Re: popping optional args from the front

2009-12-30 Thread Konrad Hinsen
On 30 Dec 2009, at 02:36, Joost wrote: > Personally, I prefer to use multple "prototypes": > > (defn bla > ([aaa bbb ccc] ) > ([bbb cc] (bla 0 bbb cc))) > > etc. That's the preferred approach for me too, but it doesn't work for functions that take a variable number of arguments. Konrad.

Re: popping optional args from the front

2009-12-29 Thread Joost
Personally, I prefer to use multple "prototypes": (defn bla ([aaa bbb ccc] ) ([bbb cc] (bla 0 bbb cc))) etc. -- 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 Note that posts from n

Re: popping optional args from the front

2009-12-29 Thread Joost
Personally, I prefer to use multiple implementations, like: (defn aaa -- 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 Note that posts from new members are moderated - please be patient wit

Re: popping optional args from the front

2009-12-29 Thread Konrad Hinsen
> On Sat, Dec 19, 2009 at 3:58 PM, Stuart Halloway > wrote: >> In Clojure it is idiomatic to have optional args at the front of the >> signature. This makes it easy to define convenient caller APIs, but >> it >> leads to bulky let forms like this one (from clojure.core/defmulti) There's clojure

Re: popping optional args from the front

2009-12-29 Thread Sean Devlin
Hmmm... if we take a look at the first arglist... [name doc-string? attr-map? [params*] body] Each of this expects a different type of object right? name - clojure.lang.Symbol doc-string? - java.lang.String attr-map? clojure.lang.IPeristentMap params* - IPeristentVector body - IPerisistentSeq

Re: popping optional args from the front

2009-12-29 Thread Rich Hickey
On Sat, Dec 19, 2009 at 3:58 PM, Stuart Halloway wrote: > In Clojure it is idiomatic to have optional args at the front of the > signature. This makes it easy to define convenient caller APIs, but it > leads to bulky let forms like this one (from clojure.core/defmulti) > >   (let [docstring   (if

Re: popping optional args from the front

2009-12-19 Thread Sean Devlin
Occasionally I have to write a custom def macro, and this would make life easier. I would have to use it to provide specific feedback, but it seems like an idea worth pursuing. On Dec 19, 3:58 pm, Stuart Halloway wrote: > In Clojure it is idiomatic to have optional args at the front of the   >

popping optional args from the front

2009-12-19 Thread Stuart Halloway
In Clojure it is idiomatic to have optional args at the front of the signature. This makes it easy to define convenient caller APIs, but it leads to bulky let forms like this one (from clojure.core/defmulti) (let [docstring (if (string? (first options)) (first optio