I want to traverse a vector tree that represents hiccup data structures:
[:div {:class "special"} [:btn-grp '("Hello" "Hi")]]
Then I want to dispatch on the keyword of the vector, if a multimethod has been defined for the keyword, then it would return another set of vectors, which will replace the original tag.
For example, the above structure will be transformed to:
[:div {:class "special"} [:div [:button "Hello"] [:button "Hi"]]]
The custom multimethod will receive the list ("hello" "hi") as parameters. It will then return the div containing the buttons.
How do I write a function that traverses the vector and dispatches on the keyword with everything else in the form as parameter, and then replaces the current form with the returned form ?
Using it: