haskell - Higher order function, parse error in pattern: xs -


here code:

-- combine lists binary operation  clwbo :: (num a, num b, num c) => (a -> b -> c) -> [a] -> [b] -> [c]  clwbo fps lista listb     |length lista /= length listb = []     |length lista ==length listb = case lista listb of                                        [] [] -> []                                        x:xs y:ys -> [fps x y] ++ clwbo fps xs ys                                        otherwise -> error "get off" 

and here error message terminal:

test.hs:8:42: parse error in pattern: xs failed, modules loaded: none. 

anyone likes tell me what's wrong code?

you cannot put multiple patterns side side in case expression. match multiple patterns @ once, put them in tuple:

case (lista, listb) of    ([], [])     -> ...    (x:xs, y:ys) -> ...    otherwise    -> ... 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -