instaparse icon indicating copy to clipboard operation
instaparse copied to clipboard

specify transformation with multimethod

Open saitouena opened this issue 5 years ago • 0 comments

I don't like constructing a map for transform. I want to write like this.

(defmulti trans (fn [tag & _] tag))

(defmethod trans :a
  [tag & xs]
  ;; body
  )

(defmethod trans :b
  [tag & xs]
  ;; body
  )

(defmethod trans :default
  [tag & xs]
  ;; body
  )

(insta/transform' trans parsed)

Currently hiccup tag is not passed to transform function. I'm thinking about adding transform' and hiccup-transform' to transform.cljc. Any ideas?

saitouena avatar Nov 26 '19 05:11 saitouena