clojure.core.core。在嵌套地图上
在clojure.core.match中,此示例在嵌套地图中效果很好,
(match [{:a {:b :c}}]
[{:a {:b nested-arg}}] nested-arg)
但是当将键
更改为vector
时,它会引起错误。
(m/match x
{:a {[:b :c] 1}}
:found
)
那不是[:b:c]
是clojure地图中的有效键吗?否则它只是在clojure.core.match
中无法使用?
in clojure.core.match , this example works well in nested map
(match [{:a {:b :c}}]
[{:a {:b nested-arg}}] nested-arg)
but when change the key
to a vector
it will raise error.
(m/match x
{:a {[:b :c] 1}}
:found
)
Isn't that [:b :c]
is a valid key in clojure map ? Or it just won't work in clojure.core.match
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
[:b:c]
当然是有效的键。这是一个错误,已经报告了,请参见打开问题。看来您也不能将映射与数字匹配为键:
[:b :c]
is of course a valid key. This is a bug and it was already reported, see opened issue.And it seems you can't also match map with numbers as keys: