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