From b20d0359500338a5babafe94da41ebee39577df1 Mon Sep 17 00:00:00 2001 From: Nathan Marz Date: Sun, 10 May 2015 08:09:48 -0400 Subject: [PATCH] add update-fast --- src/clj/com/rpl/specter.clj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/clj/com/rpl/specter.clj b/src/clj/com/rpl/specter.clj index 521e30a..d04ea50 100644 --- a/src/clj/com/rpl/specter.clj +++ b/src/clj/com/rpl/specter.clj @@ -67,6 +67,15 @@ (apply update-fn (conj vals structure))) )))) +(defn update-fast [^com.rpl.specter.impl.StructureValsPathFunctions selfns update-fn structure] + ((.updater selfns) [] structure + (fn [vals structure] + (if (empty? vals) + (update-fn structure) + (apply update-fn (conj vals structure))) + )) + ) + (defn setval "Navigates to each value specified by the selector and replaces it by val" [selector val structure]