From adef93ecba17054bc421499d745104b8192567eb Mon Sep 17 00:00:00 2001 From: Chris O'Donnell Date: Tue, 14 Jun 2016 16:46:52 -0400 Subject: [PATCH] Further explain paramsfn. --- List-of-Macros.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/List-of-Macros.md b/List-of-Macros.md index 0e3d574..b94dfa4 100644 --- a/List-of-Macros.md +++ b/List-of-Macros.md @@ -282,7 +282,13 @@ Returns an "anonymous navigator." See [defnav](#defnav). Helper macro for defining filter functions with late binding parameters. ```clojure -=> (let [c-path (comp-paths (paramsfn [val] [x] (< x val)))] - (select [ALL (c-path 5)] [2 7 3 4 10 8])) +;; val is the parameter that will be bound at a later time to complete the navigator +;; x represents the current structure for the navigator +=> (def less-than-n-pred (comp-paths (paramsfn [val] [x] (< x val)))) +=> (select [ALL (less-than-n-pred 5)] [2 7 3 4 10 8]) [2 3 4] +=> (select [ALL (less-than-n-pred 9)] [2 7 3 4 10 8]) +[2 7 3 4 8] +=> (transform [ALL (less-than-n-pred 9)] inc [2 7 3 4 10 8]) +[3 8 4 5 10 9] ```