    :post [(string? %)]}
   (let [prog (java.io.PushbackReader. (clojure.java.io/reader file))]
     (loop [form (read prog false nil)
-           fns {}]
+           fns []]
       (if form
         (let [func (compile-function form fns)]
-          (recur (read prog false nil) (assoc fns (:name func) func)))
+          (recur (read prog false nil) (conj fns func)))
         (-> fns
             (generate-main)
             (generate-prelude)

(defn compile-function
  [[name args & body :as code] fns]
  {:pre [(list? code)]}
  (let [fns (assoc fns name {})
        [stmt & stmts] (mapcat #(compile-form args fns %) body)
        code (concat [(conj stmt (format "; define %s" name))]
                     stmts

        main {:name 'main
              :code code
              :length (count code)}]
    (conj fns main)))

(defn generate-prelude
  [fns]
  (let [loads  (for [func fns]
                 [:ldf (:name func)])
        code (concat [[:dum (count fns) "; define prelude"]]
                     loads
                     [[:ldf 'main]
                      [:rap (count fns)]
                      [:rtn]])
        prelude {:name 'prelude
              :code code
              :length (count code)}]
    (vec (cons prelude fns))))

(defn emit-code
  [fns]
