You can use pointfree to answer questions such as
> pointfree "numocc x = map (length . filter (==x))"
numocc = map . (length .) . filter . (==)
change
here he is in action
> let numocc x = map (length . filter (==x))
> let numocc' = map . (length .) . filter . (==)
numocc 'a' ["aa", "bb"] --outputs [2, 0]
numocc' 'a' ["aa", "bb"] --also outputs [2, 0]
Basically, it counts the number of param1 in each element in the elements of the param2 list
numocc 'a' ["aa", "bba"] --outputs [2, 1]
numocc' 'a' ["aa", "bba"] --also outputs [2, 1]
source
share