Created
January 10, 2017 20:35
-
-
Save selfsame/166372a103f647b84cfc4b6f7b803cd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn -ogroup [form2] | |
(reduce | |
(fn [{:keys [stack cursor]} v] | |
(cond (= :v-par-start v) {:stack (conj stack []) :cursor (conj cursor 0)} | |
(= :v-par-end v) [stack] ;(first col) | |
:else {:stack (conj stack v) :cursor cursor})) | |
{:stack [] :cursor [0]} form2)) | |
(defn -ooo [form] | |
(map | |
(fn [col] | |
(if (sequential? col) (-ooo col) | |
(case col | |
ᓢ :recur | |
… :... | |
⊞ :state | |
◦╱ :left | |
◦╲ :right | |
◦⋰ :...left | |
◦⋱ :...right | |
♘ :knight-b | |
♛ :queen-w | |
♒ :nile | |
ᔖ :sexp | |
╭╮ :v-par-start | |
╰╯ :v-par-end | |
◠ :v-par-start-small | |
◡ :v-par-end-small | |
△ :tri-up | |
▽ :tri-down | |
☲ :iching | |
☄ :comet | |
✩ :star | |
➶ :arrow-up | |
➷ :arrow-down | |
col))) form)) | |
(defmacro ooo [state & more] | |
(let [body (-ogroup (reverse (-ooo more)))] | |
`(~'list ~@body))) | |
(macroexpand | |
'(ooo {} ╭╮ | |
✩ | |
◦╱ ◦╲ | |
◠ ◦⋰ ◦⋱ | |
♒ ◠ ◠ (… ✩ ♘) | |
◡ ♘ ➶ | |
☲ ♛ | |
✩ ➷ | |
◡ ◡ (… ✩ ♒ △) | |
╰╯ ⋱ ᓢ)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment