Haskell笔记 (4)—— 用前缀方法书写表达式

The infix style of writing an expression is just a convenience; we can also write an expression in prefix form, where the operator precedes its arguments. To do this, we must enclose the operator in parentheses.

举例如下:

ghci> 3 ^ 4
81
ghci> (^) 3 4
81
ghci> ^ 3 4

<interactive>:68:1: parse error on input ‘^’

 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理