I'm new to Haskell and doing some simple exercises. For this exercise I'm writing a function that checks whether one list is a subset of another list using recursion.
Here's the code:
subset [] xs = True
subset (x:xs) ys = if elem x ys == False then False
else subset (tail xs) (delete x ys)
I'm getting the following error message:
C:\Functioneel programmeren\week4.hs:9:43: error:
Variable not in scope: delete :: t1 -> t t1 -> t t1
What does this even mean?
This program only works when I change "(delete x ys)" to "ys", but then it doesn't do what it's supposed to do.
Any help would be great, thanks in advance.
deletedefined?ifcan be rewritten in a more readable form aselem x ys && subset .... Usually, we tend to avoid==Falseandif..then Falsein Haskell. Alsotail xslooks wrong, are you sure you don't wantxsinstead ?