generate human-readable code from vectors
Demo http://repo.cirru.org/writer.clj/
[cirru/writer "0.1.13"]
(cirru-writer.core/write-code [["define"
"a"
["read" "cd"]
["if" [">" "a" "cd"] ["print" "demo"] ["print" "not demo"]]]
["say" ["print" "a" ["save" ["b" ["x" ["c" "8"]]]]]]
["print" "fun"]]
)
prints:
define a (read cd)
if (> a cd)
print demo
print "not demo"
say $ print a
save $ b (x $ c 8)
print fun
Added a inline mode:
(write-code [["a" ["b" "c"] ["d" "e"] ["g" "h"]]] {:inline? true})
which generates simple expressions as inline node:
a (c b) (d e) (g h)
Test:
yarn
yarn watch-test
# another terminal
node target/test.js
https://github.com/mvc-works/coworkflow/
MIT