                forms))
 
 (defn cvt-fn [lvl params forms]
-  ["func" (cvt-fn-params params) "{\n" (cvt-fn-body (inc lvl) params forms) "}\n"])
+  ["func" (cvt-fn-params params) "{" (nl lvl)
+   (cvt-fn-body (inc lvl) params forms) "}" (nl lvl)])
 
 (defn cvt-defn [name params forms]
   ["func" (cvt-sym name) (rest (cvt-fn 0 params forms))])

       forms))

(defn cvt-let [lvl scope op [bindings & body]]
  [(interpose "\n"
              (map (fn [[var-name init-val]]
                     [(cvt-sym var-name) ":= (" (cvt-expr (inc lvl) scope init-val) ")"])
                   (partition 2 bindings)))
   "\n"
   (cvt-body (inc lvl) scope body)])

(defn cvt-if [lvl scope op [test then else]]
  ["if (" (cvt-expr (inc lvl) scope test) ") {\n"
   (cvt-expr (inc lvl) scope then)
   "\n} else {\n"
   (cvt-expr (inc lvl) scope else)
   "\n}"])

(defn cvt-cond [lvl scope op test-expr-forms]
  [(interpose "else"
              (map (fn [[test expr]]
                     ["if (" (cvt-expr (inc lvl) scope test) ") {\n"
                      (cvt-expr (inc lvl) scope expr) "\n}"])
                   (partition 2 test-expr-forms)))])

(defn cvt-ago [lvl scope op [self-actx actx body]]
  ["go {" body "}"])

(defn cvt-ago-loop [lvl scope op [self-actx parent-actx bindings & body]]
  ["(func() chan interface{} { result := make(chan interface{}, 1)\n"
   "go (func() {\n"
   (interpose "\n"
              (map-indexed (fn [idx [var-name init-val]]
                             [(str "l" idx) ":=" (cvt-expr (inc lvl) scope init-val)])
                           (partition 2 bindings)))
   "\nfor {\n"
   (interpose "\n"
              (map-indexed (fn [idx [var-name init-val]]
                             [(cvt-sym var-name) ":=" (str "l" idx)])
                           (partition 2 bindings)))
   "\n"
   (cvt-body (inc lvl) scope body)
   "\n}})()\n"
   "return result })()"])

(def cvt-special-fns

  (re-seq (re-pattern (str ".{0," width "}\\s")) (str s " ")))

(defn ljust [width s] ; Left justify a string.
  (if (> width 0)
    (format (str "%-" width "s") s)
    s))

(defn nl [lvl] (ljust lvl "\n")) ; Generate newline + indentation.

(defn read-model-file [fname]
    {:fname fname
