From 4f3393ec3dcd1d8915fab3552f343f7492ed7460 Mon Sep 17 00:00:00 2001 From: Christopher O'Donnell Date: Sat, 11 Jun 2016 08:37:19 -0400 Subject: [PATCH] Working on compiled paths/functions. --- List-of-Navigators.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 868345b..4026b4e 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -205,4 +205,27 @@ Walks code? Let's do this one later. => (transform [(collect-one :b) :a] + {:a 2 :b 3}) {:a 5 :b 3} => (transform [(collect-one :b) (collect-one :c) :a] * {:a 3 :b 5 :c 7}) -{:a 105 :b 5 :c 7} \ No newline at end of file +{:a 105 :b 5 :c 7} +``` + +### comp-paths + +`(comp-paths & path)` + +Returns a compiled version of the given path for use with compiled-{select/transform/setval/etc.} functions. This can compile navigators (defined with `defnav`) without their parameters, and the resulting compiled +path will require parameters for all such navigators in the order in which they were declared. Provides a speed improvement of about 2-15% over the inline caching introduced with version 0.11.0. + +Note that ` + +```clojure +=> (let [my-path (comp-paths :a :b :c)] + (compiled-select-one my-path {:a {:b {:c 0}}})) +0 +=> (let [param-path (comp-paths :a :b keypath))] + (compiled-transform (param-path :c) inc {:a {:b {:c 0 :d 1}}}) +{:a {:b {:c 1 :d 1}}} +``` + +### compiled-* + +These functions operate in the same way as their uncompiled brethren, but they require their path to be precompiled. \ No newline at end of file