1. w01fe
  2. lazymap

Commits

w01fe  committed 71073db

Fix bug where .entryAt returns entry when none present, and add error-checking to quote-values.

  • Participants
  • Parent commits 5a2437e
  • Branches default

Comments (0)

Files changed (1)

File src/main/clojure/lazymap/core.clj

View file
   (without     [this k] (create-lazy-map (dissoc base k) metadata))
   ; Associative
   (containsKey [this k] (contains? base k))
-  (entryAt     [this k] (LazyMapEntry. k (base k)))
+  (entryAt     [this k] (when-let [v (base k)] (LazyMapEntry. k v)))
   ; IPersistentCollection
   (count       [this]   (count base))
   (cons
 
 (defn- quote-values
   [kvs]
+  (assert (even? (count kvs)))
   (mapcat (fn [[k v]] [k `(delay ~v)]) (partition 2 kvs)))
 
 (defn lazy-assoc*