5

如何将 Hiccup 字符串解析为 Hiccup 节点?

例如, "[:b 'hello world']"进入[:b "hello world"]

4

1 回答 1

3

使用 reader 将字符串转换为数据结构:

user=> (clojure.edn/read-string "[:b 'hello world']")
[:b 'hello world']

您应该使用"来表示字符串:

user=> (clojure.edn/read-string "[:b \"hello world\"]")
[:b "hello world"]
于 2015-03-21T20:13:30.273 回答