     (gen-ctor cw fqname fv)
     (binding [*lambda-name* (if *top-level* *lambda-name* nil)]
       (gen-methods cw env methods))
-    (. cw visitEnd)))
+    (. cw visitEnd)
+    [dotname (.toByteArray cw) fv]))
 
 (defmethod compile 'lambda
   [[_ params & body :as lambda]]
   (when-not (get @*compiled-lambdas* lambda)
     (validate-params! params)
     (debug "Compiling:" lambda)
-    (let [
-          before-rest (complement #{rest-token})
-          restarg (second (drop-while before-rest params))
-]
-      (binding [*lambda-name* (if *top-level* *lambda-name* nil)]
-        (. cw visit Opcodes/V1_7 Opcodes/ACC_PUBLIC fqname nil "java/lang/Object" ifaces)
-        (gen-closure-fields cw fv)
-        (gen-ctor cw fqname fv)
-        (gen-body cw env body)
-        (gen-applier cw env)
-        (gen-handle cw env)
-        (. cw visitEnd))
-      (swap! *compiled-lambdas* conj lambda)
-      [dotname (.toByteArray cw) fv])))
+    (compile-lambda (vec (free-vars lambda)) (list (cons params body)))))
 
 (defmethod compile 'case-lambda
   [[_ & methods :as case-lambda]]
   (debug "Compiling:" case-lambda)
-  (let [fv (vec (free-vars case-lambda))
-        cw (ClassWriter. ClassWriter/COMPUTE_FRAMES)
-        lname (str (dotmunge (str (or *lambda-name* 'lambda))) "_" (next-id))
-        fqname (str "wombat/" lname)
-        dotname (.replace fqname "/" ".")
-        ifaces (into-array String ["wombat/ILambda"])]))
+  (compile-lambda (vec (free-vars case-lambda)) methods))
 
 (defn emit
   [env context gen form]

  (fn [_ _ _ form] (first form))
  :default -invoke-)

(defmethod emit-seq 'lambda
  [env context ^GeneratorAdapter gen [_ params & body :as lambda]]
  (when-not (= context :context/statement)
    (let [[dotname bytecode closed-overs] (binding [*top-level* nil]
                                            (compile lambda))]

        
        (. gen mark switch-label)
        ;; arity arg is on stack
        (. gen tableSwitch (int-array fixed) switch-generator)
        (. gen mark end-switch-label))
    
      (. gen returnValue)
