Hi Mark,

Am 27.04.2009 um 23:42 schrieb Mark Volkmann:

Is there something in core or contrib that supports creating a map
where gets on undefined keys return a specified default value? For
example, I'd like to create a hashmap where the default value for
missing keys is zero.

You can specify the default value when retrieving the value:

(def m {:a 1 :b 2})
(get m :c 0) => 0
(m :c 0) => 0 (untested)
maybe also: (:c m 0) => 0 (also untested)

Sincerely
Meikel

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

Reply via email to