   (if-not (pattern/def? ast)
     ast
     (let [top-level-forms (atom [])
-          new-fn-ast      (rewrite-fn (get ast :init)
-                                      ast top-level-forms)]
+          new-ast         (update ast :init
+                                  update-through-meta
+                                  rewrite-fn
+                                      ast
+                                      top-level-forms
+                                      munged-fns-atom)]
 
       (-> @top-level-forms
           vec
-          (conj (assoc ast :init new-fn-ast))))))
+          (conj new-ast)))))
+
+
+(defn var-name
+  [v]
+  (symbol
+   (-> v .ns ns-name str)
+   (-> v .sym str)))
+
+
+(defn rewrite-fn-invokes
+  "λ AST → (Atom {Var → {(U Number :variadic) → Var}}) → AST
+
+  Walks the argument AST, rewriting invoke nodes where it is possible
+  to call a previously emitted single arity function rather than a
+  decomposed multiple arity function by doing static arity resolution
+  defaulting to the variadic implementation if present and failing
+  back to the original unaltered function in all cases. Returns an
+  updated top level form."
+  [top-ast munged-fns]
+  (let [munged-fns @munged-fns]
+    (postwalk top-ast
+              (fn [{:keys [op fn args env] :as node}]
+                (if (and (= op :invoke)
+                         (= :var (:op fn)))
+                  (if-let [arities (munged-fns (-> fn :var))]
+                    (if-let [var (get munged-fns
+                                      (count args)
+                                      (get munged-fns :variadic))]
+                      (assoc node :fn (ast (var-name var) env))
+                      node)
+                    node)
+                  node)))))
 
 
 (defn reduce-fn-arities

                              methods
                              promotes)))]

      (reset! prefix-forms-atom
              (if name
                (cons fdecl promotes)



(defn munge-symbol
  [sym arity variadic]
  (symbol
   (str sym "$arity$"
        (if variadic
          (- arity 2)
          arity)
        (when variadic
          "+"))))


(defn method-variadic?
  [method]
  (if (list? method)
    (some (partial = '&) (first method))
    (if (map? method)
      (or (:variadic? method)
          (some :variadic?
                (:params method))))))


(defn munge-fn-name
