Consider this:
map fromEnum $ zipWith (==) "aaaa" "abaa" -- [1,0,1,1]
It would be nice to have only one step here:
zipWith (\xy -> fromEnum (x == y)) "aaaa" "abaa"
Now I can exclude y :
zipWith (\x -> fromEnum.(x ==)) "aaaa" "abaa"
But I can not exclude x . Of course, there are ways to "cheat" ...
zipWith (curry (fromEnum . uncurry (==))) "aaaa" "abaa"
... but it looks uglier than the original lambda.
The function I'm looking for will be somewhat similar to Data.Function.on , but the other way around. I have the feeling that there is an embarrassing simple solution for this. Am I missing something?
source share