0 parameters haskell functional-programming tuples
在 Haskell 中我怎么写:
function :: (Int,Int) ....
function Not(0,0) otherparameters = []
Run Code Online (Sandbox Code Playgroud)
即我有一个函数,除了第一个参数是元组 (0,0) 之外,我想为每种情况返回一个空列表
在 Haskell 中怎么可能做到这一点?
我尝试过函数(不是(0,0))但出现以下错误
Parse error in pattern: not
Run Code Online (Sandbox Code Playgroud)
非常感谢
首先写出异常模式:
function :: (Int,Int) ....
function (0,0) otherParameters = exceptionalResult
function _ _ = [] -- empty list in every other case
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
62 次 |
| 最近记录: |