hoping for some help on this one with my newbie Haskell code.
I'm trying to compare an input list of variables with an infinite list of variables
input = ["a", "b", "x"]
variables = ["a", "b", "c", "d", ... "a1", "b1", ... and so on]
I'd like to find the first non-occurring variable in the input list, in this case it should be "c".
I think the right way to go about it is using a filter...
ourFilter :: [Var] -> [Var] -> [Var]
ourFilter p [] = []
ourFilter p (x:xs) | matches x = x ourFilter xs
| otherwise = ourFilter xs
matches :: Var -> Bool
matches n = n `elem` variables
...but I'm getting the two errors thrown before compilation and I can't get my head around them:
• Couldn't match expected type ‘([Var] -> [Var] -> [Var])
-> [Var] -> [Var]’
with actual type ‘[Char]’
• The function ‘x’ is applied to two arguments,
but its type ‘[Char]’ has none
Can somebody help to explain what on earth is going on? Is this the right way to go?
Thanks!