
22 Apr
2016
22 Apr
'16
9:20 p.m.
Dear List, I am stuck. I have a function that needs to apply each item of one list to every element of the second list in turn. So far, I have this function: checkNum :: Int -> [Int] -> (Int,[Int]) checkNum a b = (a,filter (check a) $ b) which implements what I need, but I now need to apply it to every element of the first list. I am looking for something like: list1 = [1,2,3,4,5,6] list2 = [1,2,3,4,5,6] map checkNum list1 list2 to return: [(1,[1]),(2[3,4,5]),(6,[3]) (I have tried to simplify this a little, so my apologies if it looks pointless - the real function is useful) Any help would be appreciated. Matt