Hello,

Am 19.10.2008 um 00:12 schrieb kwatford:

I don't think adding this should conflict with any existing code,
though I did notice that "get" currently accepts and apparently
ignores one extra parameter.
No. It does not ignore the extra parameter! This is a default value,
which is returned in case the index is not contained in the vector.

user=> (def x [:a :b])
#=(var user/x)
user=> (get x 0 :foo)
:a
user=> (get x 1 :foo)
:b
user=> (get x 2 :foo)
:foo

See also the help of get:

user=> (doc get)
-------------------------
clojure/get
([map key] [map key not-found])
  Returns the value mapped to key, not-found or nil if key not present.

This works also for maps and sets, not only vectors.

Sincerely
Meikel

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to