summaryrefslogtreecommitdiff
path: root/src/clojure_sql/util.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/clojure_sql/util.clj')
-rw-r--r--src/clojure_sql/util.clj15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/clojure_sql/util.clj b/src/clojure_sql/util.clj
index cd8e8b6..f2edf30 100644
--- a/src/clojure_sql/util.clj
+++ b/src/clojure_sql/util.clj
@@ -1,4 +1,5 @@
-(ns clojure-sql.util)
+(ns clojure-sql.util
+ (:require [clojure.set :as set]))
(defn funcall [f & args]
(apply f args))
@@ -11,3 +12,15 @@
(->> m
(map (comp vec reverse))
(into {})))
+
+(defn map-kv [f & maps]
+ (let [all-keys (into #{} (mapcat keys maps))]
+ (->> all-keys
+ (map (fn [key]
+ (apply f key (map #(get % key) maps))))
+ (into {}))))
+
+(defn map-vals [f & maps]
+ (apply map-kv (fn [k & vs]
+ [k (apply f vs)])
+ maps))