                                  eval-func (eval-parsed-cljs-code func state)]
                              (if (fn? eval-func)
                                eval-func
-                               (get-in state
-                                       [:fns eval-func])))
+                               (get *fns* eval-func)))
                            (mapv #(eval-parsed-cljs-code % state)
                                  (rest c)))
         :default c))


(defn template->hiccup
  [tmplt state]
  (let [s (update-in state
                     [:fns]
                     (fn [fns] (merge {"=>" (fn [source dest]
                                              (mapv #(assoc state dest %)
                                                   source))
                                       "identity" identity
                                       "vector" vector
                                       "hashmap" hash-map
                                       "set" set
                                       "resolve-symbol" #(or (get-in % [:fns %2])
                                                             (dbg2 "r-s =" (get % (dbg2 "r-s %2 =" %2) "[empty]")))
                                       "template" #(render-template % (dbg2 "template %2= " %2) :fns (:fns state))}
                                      fns)))]
    (->> tmplt
         (walk/prewalk (fn [h]
                         (reduce (fn [current [pred proc-fn]]
                                   (if-let [r (pred current)]
                                     (proc-fn r)
                                     current))
                                 h
                                 (processors s))))
         (walk/postwalk flatten-out))))

(defn cached-template->hiccup
  [tname state]
  (dbg2 "cached-template->hiccup state =" state)
  (let [r (template->hiccup (get @template-cache tname) state)]
    r))



(defn eval-om-if-expr
  [x state]
  (get state (apply str (mapcat second x))))

(defn html->template
