I’m trying to get the number keys of a map. the code I came up with is since I have to use map and set and prelude only
type Film = (Fan, Title, Review)
filmRating :: [Film] -> [(Fan, Int)]
filmRating l = undefined
Map.fromListWith (++) [(f, [t]) | (f, t, _) <- l]
I put [t] so I could then count that list, but apparently im doing it wrong somewhere and it doesnt work
I want it to give me something like this:
input : [(“fan1”, “film1”, 3), (“fan1”, “film2”, 3), (“fan3”, “film1”, 5), (“fan4”, “film3”, 8)]
output: [(“fan1”, 2). (“fan3”, 1), (“fan4”, 1)] (number of films a fan watched)