简体   繁体   English

语法Haskell中的@是什么?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM