Reputation: 395
I'm trying to compile this function:
fff [] _ = []
fff (x:xs) ys
| r == [] = xs1
| otherwise ys ++ xs1
where r = filter (x<) ys
xs1 = fff xs ys
But I get this error:
Test.hs:14:4: parse error on input `where'
Failed, modules loaded: none.
Any help to solve it?
Thanks,
Sebastián.
Upvotes: 0
Views: 737
Reputation: 15121
You missed the required =
after otherwise
.
By the way, r == []
better be replaced by the more general null r
.
Try this:
fff [] _ = []
fff (x:xs) ys
| r == [] = xs1
| otherwise = ys ++ xs1
where r = filter (x<) ys
xs1 = fff xs ys
Upvotes: 2