Skip to content

pallet/pallet-map-merge

Repository files navigation

pallet-map-merge

A library to allow merging of clojure maps using per-key merge policies.

Usage

By default, merge-keys does a deep merge:

(merge-keys {} {:a {:c 2}} {:a {:b 1}})
  => {:a {:b 1 :c 2}}

You can override this by specifying a merge policy on a per key basis.

(merge-keys {:a :union} {:a #{1}} {:a #{2}})
  => {:a #{1 2}}
(merge-keys
 {:a :concat :b :union}
 {:a [1] :b #{1}}
 {:a [2] :b #{2}})
  => {:a [1 2] :b #{1 2}}

API docs

Installation

To use pallet-map-merge, add the following to your :dependencies in project.clj:

[pallet-map-merge "0.1.1"]

Build Status

License

Copyright © 2012 Hugo Duncan

Distributed under the Eclipse Public License.

About

A library to allow merging of clojure maps using per-key merge policies.

Resources

Stars

Watchers

Forks

Packages

No packages published