gpt4 book ai didi

clojure - 如何将字符串解析为 Hiccup?

转载 作者:行者123 更新时间:2023-12-02 12:06:12 25 4
gpt4 key购买 nike

如何将一串 Hiccup 解析为 Hiccup 节点?

例如,将 "[:b 'hello world']" 转换为 [:b "hello world"]

最佳答案

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

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

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

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

关于clojure - 如何将字符串解析为 Hiccup?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29179043/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com