[英]Syntax What does @ in Haskell?
我是Haskell的新手,我注意到@在阅读代码时有特定的作用,有人知道究竟做了什么?
@ is used in pattern matching for keeping the binding to the whole thing. @用于模式匹配以保持对整个事物的绑定。
Example: 例:
In x@(a:as)
, x
will refer to the entire list a:as
. 在x@(a:as)
, x
将引用整个列表a:as
。
In the above example, you can get the whole list via x
instead of typing yourself a:as
again. 在上面的示例中,您可以通过x
获取整个列表,而不是键入自己a:as
再次。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.