(def-derived-map name params & {:as m})
Allows a map type to be defined where key-value pairs may be derived from fields.
For instance, if we want to create a map which contains both upper and lower-case versions of a string without immediately instantiating both, we can do this:
(def-derived-map StringMap [^String s] :lower-case (.toLowerCase s) :upper-case (.toUpperCase s))
The resulting map will behave correctly if the defined keys are removed, shadowed, etc.
The above class will automatically create a constructor named '->StringMap'.
Allows a map type to be defined where key-value pairs may be derived from fields. For instance, if we want to create a map which contains both upper and lower-case versions of a string without immediately instantiating both, we can do this: (def-derived-map StringMap [^String s] :lower-case (.toLowerCase s) :upper-case (.toUpperCase s)) The resulting map will behave correctly if the defined keys are removed, shadowed, etc. The above class will automatically create a constructor named '->StringMap'.
(def-map-type name params & body)
Like deftype, but must contain definitions for the following functions:
(get [this key default-value]) (assoc [this key value]) (dissoc [this key]) (keys [this]) (meta [this]) (with-meta [this meta])
All other necessary functions will be defined so that this behaves like a normal Clojure map. These can be overriden, if desired.
Like deftype, but must contain definitions for the following functions: (get [this key default-value]) (assoc [this key value]) (dissoc [this key]) (keys [this]) (meta [this]) (with-meta [this meta]) All other necessary functions will be defined so that this behaves like a normal Clojure map. These can be overriden, if desired.
(assoc* m k v)
(dissoc* m k)
(empty* m)
(get* m k default)
(keys* m)
(meta* o)
(with-meta* o mta)
(reify-map-type & body)
Like reify, but must contain definitions for the following functions:
(get [this key default-value]) (assoc [this key value]) (dissoc [this key]) (keys [this])
All other necessary functions will be defined so that this behaves like a normal Clojure map. These can be overriden, if desired.
Like reify, but must contain definitions for the following functions: (get [this key default-value]) (assoc [this key value]) (dissoc [this key]) (keys [this]) All other necessary functions will be defined so that this behaves like a normal Clojure map. These can be overriden, if desired.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close