這裏是我的代碼:高階函數,輸入`|'解析錯誤
select_where_true :: (Double -> Bool) -> [Double] -> [Double]
select_where_true is_neg [a] = case [a] of
[] -> []
x:xs -> is_neg x
|(is_neg x) == False = []
|(is_neg x) == True = x ++ (select_where_true is_neg xs)
is_neg :: Double -> Bool
is_neg x = x < 0
這裏是錯誤消息:
[1 of 1] Compiling Main (test.hs, interpreted)
test.hs:5:18: parse error on input `|'
Failed, modules loaded: none.
任何人都喜歡告訴我什麼是錯我的代碼?
感謝任何能夠幫助我的人一些建議。
THXü這麼多,我都遵循什麼ü說和固定它。 – libra 2013-05-14 01:44:42