                                     global-var-init-statements)) 
         let-statements (into init-statements let-statements)
         expr `(let-mutable ~let-statements ~return-value)]
-    (println "chunk-fn2:" global-var-init-statements)
+    (println "post-process-blocks out:" let-statements)
+    ;(println "chunk-fn3:" global-var-init-statements)
     expr
     ))
+
+(comment
+
+  (select
+    [ALL
+     (if-path (pred #(= (safe-some-> %1 first) 'clojure.core/fn))
+             LAST
+             STAY)]
+              
+    `((clojure.core/fn :a :b)
+      (let-mutable [:a :b])))
+  )
+(defn chunk-fn [& args]
+  (println "chunk-fn:" args)
+  (let [r (transform [ALL 
+                (if-path (pred #(= (safe-some-> %1 first) 'clojure.core/fn))
+                         LAST
+                         STAY) ]
+               #(post-process-blocks %1)
+               args)]
+    (println "chunk-fn result:" r)
+    (first (transform [ALL] #(apply list %1) r))))
 
 (defn block-fn [& args]
   (println "block-fn args:" args)

            [luaclj.library :refer :all]
            [com.rpl.specter :refer [select 
                                     ALL
                                     select-first
                                     pred
                                     subselect 
                                     transform 
                                     walker]]

  )
(defmacro or= [arg values]
  `(or ~@(map #(= arg %1) values)))
(defn post-process-blocks [& args]
  (println "post-process-blocks" args)
  (let [set-var-pred #(= 'set! (safe-some-> %1 first))
        all-vars (set (map second
                           (select (walker set-var-pred) args)))
