From 945c38cf2000494b3f7697ab9c12a1ce12c7ab00 Mon Sep 17 00:00:00 2001 From: Stuart Sierra Date: Sat, 17 Jan 2009 22:55:21 +0000 Subject: walk.clj: added macroexpand-all, a simple demonstration of a walking function --- src/clojure/contrib/walk.clj | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/clojure') diff --git a/src/clojure/contrib/walk.clj b/src/clojure/contrib/walk.clj index 6a6e06e2..5c1e9a3e 100644 --- a/src/clojure/contrib/walk.clj +++ b/src/clojure/contrib/walk.clj @@ -114,3 +114,9 @@ replacement at the leaves of the tree first." [smap form] (postwalk (fn [x] (if (contains? smap x) (smap x) x)) form)) + +(defn macroexpand-all + "Recursively performs all possible macroexpansions in form." + [form] + (prewalk (fn [x] (if (list? x) (macroexpand x) x)) form)) + -- cgit v1.2.3-70-g09d2