Reputation:
I have this function :
count :: Int -> [(Float,Int)] -> Int
count n p = length $ filter ((==n).snd) p
and I want to transpose it to a foldr but im having troubles with the lambda function
Upvotes: 0
Views: 130
Reputation: 4938
Try this:
count n = foldr (\(f,i) j -> if (i==n) then j+1 else j) 0
Upvotes: 1