0
我正試圖找出兩個數字之間的值。到目前爲止,我有:計數兩個數字之間的數值haskell
heightbetween :: Float -> Float -> [Float] -> Int
heightbetween _ _ [] = 0
heightbetween n s (x:xs)
| (n < x) : (s > x) = 1 + (heightbetween n s xs)
| otherwise = heightbetween n s xs
使用'&&'爲「和」兩個布爾值,而不是':'。另外,'長度。過濾器(\ x - > n
chi
2014-11-21 15:06:20
是的我擁有它但是是這樣做的: – caz 2014-11-21 15:21:14
{heightbetween :: Float - > Float - > [Float] - > Int heightbetween _ _ [] = 0 nS(x:xs)之間的高度 | (n < x) && (s > x)= 1 +(n s xs之間的高度) |否則= n之間的高度s xs }我這樣做了,感謝您的幫助。 – caz 2014-11-21 15:40:39