From c47650993d5d5510fea201d8f8edcdb90f447dd9 Mon Sep 17 00:00:00 2001 From: Nathan Marz Date: Sun, 10 May 2015 19:56:30 -0400 Subject: [PATCH] improve performance of non-compiled code path by 3x, remove ability for a vector to be considered a structurepath --- src/clj/com/rpl/specter.clj | 2 +- src/clj/com/rpl/specter/impl.clj | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/clj/com/rpl/specter.clj b/src/clj/com/rpl/specter.clj index 6b2239d..e7dbd94 100644 --- a/src/clj/com/rpl/specter.clj +++ b/src/clj/com/rpl/specter.clj @@ -153,7 +153,7 @@ e.g. (selected? :vals ALL even?) keeps the current element only if an even number exists for the :vals key" [& selectors] - (let [s (comp-paths selectors)] + (let [s (comp-paths* selectors)] (fn [structure] (->> structure (select s) diff --git a/src/clj/com/rpl/specter/impl.clj b/src/clj/com/rpl/specter/impl.clj index 92383fe..900c3be 100644 --- a/src/clj/com/rpl/specter/impl.clj +++ b/src/clj/com/rpl/specter/impl.clj @@ -97,17 +97,17 @@ updater (.updater sp)] (->StructureValsPathFunctions (fn [vals structure next-fn] - (selector vals structure + (curr-selector vals structure (fn [vals-next structure-next] - (curr-selector vals-next structure-next next-fn) + (selector vals-next structure-next next-fn) ))) (fn [vals structure next-fn] - (updater vals structure + (curr-updater vals structure (fn [vals-next structure-next] - (curr-updater vals-next structure-next next-fn) + (updater vals-next structure-next next-fn) ))) ))) - (->> structure-paths flatten (map coerce-path) reverse)) + (map coerce-path structure-paths)) )) ;; cell implementation idea taken from prismatic schema library