Reputation: 173
So I am defining a function that maps values to a 1 or 0 depending on whether there is a match or not.
For instance:
match 3 [1,2,3,4,5] == [0,0,1,0,0]
What I have written so far for defining my 'match' function is:
let match :: a -> [a] -> [Int]; match x xs = map
And of course I haven't finished writing it out after 'map' and this is what I need help on.
Upvotes: 1
Views: 209
Reputation: 15121
Or you could try this some kind of more straightforward version:
match e xs = map (\x -> if x == e then 1 else 0) xs
Upvotes: 1