• (fnmap getter setter)
  • (fnmap getter setter & keyvals)
Creates a fnmap, or functional map. A fnmap behaves like an
ordinary Clojure map, except that calls to get and assoc are
filtered through user-defined getter and setter functions, which
operate on an internal map.

(getter m key) should return a value for key.

(setter m key value) should assoc key with value and return a new
map for m.

All other map operations are passed through to the internal map.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/fnmap.clj:19 top

(defn fnmap
  "Creates a fnmap, or functional map.  A fnmap behaves like an
  ordinary Clojure map, except that calls to get and assoc are
  filtered through user-defined getter and setter functions, which
  operate on an internal map.

  (getter m key) should return a value for key.

  (setter m key value) should assoc key with value and return a new
  map for m.

  All other map operations are passed through to the internal map."
  ([getter setter] (clojure.contrib.fnmap.PersistentFnMap/create getter setter))
  ([getter setter & keyvals]
      (apply assoc
             (clojure.contrib.fnmap.PersistentFnMap/create getter setter)
             keyvals)))
Vars in clojure.contrib.fnmap/fnmap: create apply assoc defn
Used in 0 other vars

Comments top

No comments for fnmap. Log in to add a comment.