    :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 assign-addresses
  [fns]
  {:pre [(map? fns)
         (every? symbol? (keys fns))
         (every? map? (vals fns))]
   :post [(every? (comp integer? :address) %)]}
  (let [prelude (fns 'prelude)
        others (vals (sort (dissoc fns 'prelude)))]
    (loop [funcs (vec (concat [prelude] others))
           index 0
           address 0]
      (if-let [func (get funcs index)]
        (do (prn func) (let [new-funcs (update-in funcs [index] assoc :address address)
              address (+ address (:length func))]
          (recur new-funcs (inc index) address)))
        funcs))))

(defn code->str
  [fn-addrs line]

    (macros form)

    (symbol? form)
    (if (some #(= (:name %) form) fns)
      [[:ldf form]]
      [[:ld 0 (.indexOf vars form)]])

