Hi,

Am 06.12.2010 um 10:14 schrieb Ken Wesson:

>> Then we could use arity functions. (Alex Osborne)
>> 
>>    (defn list-length
>>      ([coll]   (list-length coll 0))
>>      ([coll n] (if-let [s (seq coll)]
>>                     (recur (rest s) (inc n))
>>                      n)))
>> 
>> This is nice style in my opinion
> 
> Not in mine -- it exposes a public API of
> list-length-plus-some-integer that a) doesn't make much sense and b)
> is unlikely to be supported, since the implementation could be changed
> to one that doesn't expose this.

One can easily hide the second arity from the contract.

(defn list-length
  {:arglists '([coll])}
  ...)

Sincerely
Meikel

-- 
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 with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to