(defmulti fill
(fn [node value] (:tag node))) ; this is the dispatch function
(defmethod fill :div
[node value]
(assoc node :content [(str value)]))
(defmethod fill :input
[node value]
(assoc-in node [:attrs :value]
(str value)))
;; tests
(fill {:tag :div} "hello")
(fill {:tag :input} "what")
Friday, October 16, 2015
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment