From 378ea1311823b741ad8eb033d20539a2522fa7a3 Mon Sep 17 00:00:00 2001 From: Christophe Grand Date: Tue, 15 Sep 2015 14:32:30 +0200 Subject: [PATCH] Delay xforms applications to not share state. --- src/net/cgrand/xforms.clj | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/net/cgrand/xforms.clj b/src/net/cgrand/xforms.clj index b9eace7..c3687fb 100644 --- a/src/net/cgrand/xforms.clj +++ b/src/net/cgrand/xforms.clj @@ -301,10 +301,11 @@ Returns a map with the same keyset as xforms-map (or a vector of same size as xforms-map). Returns a transducer when coll is omitted." ([xforms-map] - (let [rf (if (vector? xforms-map) - (apply juxt (map #(% just) xforms-map)) - (apply juxt-map (sequence (comp (by-key (map #(% just))) cat) xforms-map)))] - (reduce rf))) + (let [[f args] (if (vector? xforms-map) + [juxt (map #(% just))] + [juxt-map (comp (by-key (map #(% just))) cat)])] + (fn [rf] + ((reduce (apply f (sequence args xforms-map))) rf)))) ([xforms-map coll] (transduce (transjuxt xforms-map) just coll)))