             {(if (coll? xl)
                (sym-seq->parent xl)
                xl)
-             {:tree nil    ;; placeholder for trace tree
-              :xl xl              ;; expanded location
+             {:tree nil ;; placeholder for trace tree
+              :xl xl    ;; expanded location
               :orig (-> xl
-                       xl->xform
-                       xform->form)  ;; original symbol or value
+                        xl->xform
+                        xform->form) ;; original symbol or value
               :x (-> xl
                      xl->xform)
               :xlxp (xl->xlxp xl) ;; expanded locations expanded parent

      new-tree)))

(defn produce-recent-tree-atom!
  [inner-path recent-trees & {:keys [skip-closed-check]}]
  (if-let [tree-atom (get-recent-tree-at-inner-path inner-path
                                                         recent-trees
                                                         :skip-closed-check skip-closed-check)]
    tree-atom
    (mk-recent-tree-at-inner-path inner-path
                                  recent-trees)))

(defn produce-recent-parent-tree-atom!
  [inner-path recent-trees]
  (let [parent-inner-path (some-> inner-path
                                  not-empty
                                  drop-last
                                  vec)]
    (if-let [parent (get-recent-tree-at-inner-path parent-inner-path
                                                   recent-trees)]
      parent
      (mk-recent-tree-at-inner-path parent-inner-path recent-trees))))

(defn tr-fn
  [inner-path [recent-trees] template f]
  (fn [& args]
    (let [this (-> @(produce-recent-tree-atom! inner-path
                                               recent-trees)
                   (merge template)
                   (assoc :args (vec args)
                          :arg-map (delay (zipmap (:arg-forms template)

  [form parent-fn-meta]
  (let [expr-map (mk-expr-mapping form)
        xform (xpand-form form expr-map parent-fn-meta)]
    `(let [~'$$ (atom {})
           ~'$return ~xform]
       (record-trace-tree! ~'$$)
       ~'$return)))
