“(?符号?名称)”是什么意思?
我什至在为这个问题选择标题时都遇到了问题。请随意编辑。
我得到了这个方案代码,但不理解这个块。
(define (func b)
(match b
[(list (? symbol? x) rhs) ...
问题部分是(?符号?x)。我猜它是某种比较器,但我在任何地方都没有找到任何有关它的信息!很难搜索它,因为我不知道如何命名这个命令。
我想至少知道它的名字,感谢进一步的解释。 =)
谢谢!
I had problem even in choosing a title for this question. Please feel free to edit it.
I got this Scheme code and did not understand this block.
(define (func b)
(match b
[(list (? symbol? x) rhs) ...
The trouble part is (? symbol? x). I guess it's a comparator of some sort, but I didn't find anything about it anywhere! It's hard to search it, since I don't know how to name this command.
I would like to get at least its name, further explanations are appreciated. =)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
刚刚找到了!
这是 (match ...) 语法的特定情况。在这里找到它:模式匹配
更具体:
其中 pat 是
所以我有点对:它检查 x 是否是一个符号。
我很幸运!请完成本题!
非常感谢!
Just found it!
It's a specific case of (match ...) syntax. Found it here: Pattern Matching
More specific:
Where pat is
So I was kinda right: it's checking if x is a symbol.
I was lucky! Please complete this topic!
Many thanks!