mylesmegyesi/clojure.core — pull request #3 by patrickgombert (2014-01-05 20:39:21+00:00)
Title: Implement get/3, allowing for user specified not-found

My first attempt was to do the following

src/clj/clojure/lang/ipersistent_map.clj
```clojure
(-lookup [this k] [this k not-found])
```

src/clj/clojure/lang/persistent_array_map.clj
```clojure
(list '-lookup
(list ['this 'k]
(list 'array-map-lookup '-arr '-size 'k))
(list ['this 'k 'not-found]
(list 'if (list 'array-map-contains? '-arr '-size 'k)
(list 'array-map-lookup '-arr '-size 'k)
'not-found)))
```

src/clj/clojure/lang/persistent_map.clj
```clojure
(defn get
([m k] (-lookup m k))
([m k not-found] (-lookup m k not-found)))
```

which is how clojure does it, but I kept running into
```clojure
Unsupported binding form: (array-map-lookup -arr -size k)
```
with the macro in src/clj/clojure/lang/persistent_array_map.clj

I abandoned that in favor of the current approach, and I think it's nicer because it keeps the `IPersistentMap` interface smaller and makes the default of get/2 explicit. Thoughts?

I implemented this because I need to default keys in a configuration map.