(defn
get
"Returns the value mapped to key, not-found or nil if key not present."
([o k]
(when-not
(nil? o)
(cond
(implements? ILookup o)
(-lookup o k)
(array? o)
(when (and (some? k) (< k (.-length o))) (aget o (int k)))
(string? o)
(when (and (some? k) (< k (.-length o))) (.charAt o (int k)))
(native-satisfies? ILookup o)
(-lookup o k)
:else
nil)))
([o k not-found]
(if-not
(nil? o)
(cond
(implements? ILookup o)
(-lookup o k not-found)
(array? o)
(if
(and (some? k) (>= k 0) (< k (.-length o)))
(aget o (int k))
not-found)
(string? o)
(if
(and (some? k) (>= k 0) (< k (.-length o)))
(.charAt o (int k))
not-found)
(native-satisfies? ILookup o)
(-lookup o k not-found)
:else
not-found)
not-found)))