   (or (meta form)
       (-> form first meta)))
 
+(defn tr-loop
+  [template tree-atom v]
+  (-> (produce-recent-tree-atom! (:inner-path template)
+                                 (:path-parents template)
+                                 tree-atom)
+      deref
+      (merge template)
+      (assoc :return v
+             :inner-tags [:loop])
+      (update-tree! tree-atom))
+  v)
+
+(defn xpand-loop-form
+  [[_ binds & body] path-sym recur-arities]
+  `(tr-loop ~path-sym
+            ~'$$
+            (loop ~binds
+              (let [~'$$return ~@body]
+                ~(mk-recur-handler recur-arities)))))
+
+(defn xpand-loop
+  [form src-map fn-meta path path-parent]
+  (let [xmap (xpand-all form
+                        src-map
+                        fn-meta
+                        path
+                        path-parent)]
+    (layer-xpansion-maps xmap
+                         {:path-parents {path path-parent}
+                          :templates {path (mk-tree-template src-map
+                                                             (get-form-meta-somehow form)
+                                                             fn-meta
+                                                             path)}
+                          :form (xpand-loop-form (:form xmap)
+                                                 (path->sym path)
+                                                 (:recur xmap))})))
+
 (defn tr-recur
   [template tree-atom & args]
   (let [args' (with-meta (vec args) {::util/recur true})]

       (clojure.pprint/pprint trace/*trace-log-parent*)))

#_ (binding [trace/*trace-log-parent* @com.billpiel.sayid.core/workspace]
     (let [f1 (inner-tracer {:qual-sym 'com.billpiel.sayid.inner-trace3/f1
                            :meta' {:ns 'com.billpiel.sayid.inner-trace3
                          :name 'com.billpiel.sayid.inner-trace3/f1}
                            :ns' 'com.billpiel.sayid.inner-trace3})]
       (f1 1)
       (clojure.pprint/pprint trace/*trace-log-parent*)))

      (update-tree! tree-atom))
  v)

(defn xpand-if-form
  [[_ test then else] path-sym]
  `(tr-if-ret ~path-sym
