我一直在谷歌上寻找答案,甚至在这里问了几个问题.这似乎是一个模棱两可的错误,我无法弄清楚如何在我的实例中解决它.
违规代码如下:
pos :: (Eq a) => [a] -> a -> Int
pos [] _ = -1
pos (x:xs) y
| not $ elem y (x:xs) = -1
| x == y = 0
| otherwise = 1 + pos xs y
-- Get the same element from another range as one element of the first range.
refPos :: (Eq a) => [a] -> [b] -> a -> b
refPos r1 r2 e1 = r2 !! (r1 `pos` e1)
letterNumber …Run Code Online (Sandbox Code Playgroud) 仅仅一秒钟之前,我正在使用PHP,试图弄清楚是否存在本机范围函数(最终找到range)。但是,我尝试的事情之一是:
echo 1...2;
Run Code Online (Sandbox Code Playgroud)
令我惊讶的是返回字符串"10.2"。谁能确切告诉我是什么语法引起的?对于splat操作员来说,这似乎不是一个有效的地方。