   (cons 'some->> (interpose '((fn [arg] 
                               (when (sequential? arg) arg)))
                            args)))
+
+(def third #(nth %1 2))
+(def fourth #(nth %1 3))
+
 (defn leave [odd-or-even-kw items]
   (map second (remove #((if (= odd-or-even-kw :odd) odd? even?) (first %1)) (map #(vector %1 %2) (range) items))))
 
-(defn get-var-init-statements [& args]
-  (let [set-statements (select (walker #(= (safe-some-> %1 first) 'set!)) args)
-        vars (into (hash-set) (map second set-statements))
-        var-init-statements (mapcat identity (map #(vector %1 nil) vars)) ]
-    var-init-statements
-  ))
-(defn get-local-var-init-statements [& args]
-  (let [set-statements (select (walker #(= (safe-some-> %1 first) :local)) args)
-        vars (into (hash-set) (map #(nth %1 2) set-statements))
-        var-init-statements (mapcat identity (map #(vector %1 nil) vars)) ]
-    var-init-statements
-  ))
 (comment
   (let [s [[{:a 1} ['(set! a 3) :b #{'('(set! b 4))}]] ['(['(set! a 6)])]]
         walker-fn #(safe-some->> %1 (some (fn [arg] (= arg 'set!))))


(defn chunk-fn [& args]
  (println "chunk-fn:" args)
  (let [global-var-init-statements (get-var-init-statements args)
        let-statements (if (= (safe-some-> args first first) 
                              'proteus/let-mutable)
                         (-> args first second) 
                         (first args))
        modify-set-statements-fn (fn [arg]
                                   (mapcat #(if (= (first %1) :local)
                                              [(nth %1 2) (nth %1 3)]
                                              ['_ %1]) arg))
        walker-fn (fn [arg]
                    (or (= 'set! (safe-some-> arg first first)) 
                        (= 'set! (safe-some-> arg first second))))
        let-statements (transform (walker walker-fn)
                                  modify-set-statements-fn
                                  let-statements)
        modify-let-mutables-fn (fn [arg]
                                 (println "modify:" (next arg))
                                 `(let-mutable ~(vec (apply concat (first (next arg))))))
        let-statements (transform (walker #(= 'proteus/let-mutable (safe-some-> %1 first)))
                                  modify-let-mutables-fn
                                  let-statements)
        return-value (gensym)
        returned? (gensym)
        process-return-stmts (fn [arg]

            [proteus :refer [let-mutable]]
            [clojure.pprint :refer [pprint]]
            [clojure.string :as str]
            [clojure.set :as set]
            [com.rpl.specter :refer [select 
                                     ALL
                                     select-first
