I\'ve been trying to define a function which, given a list of Integers and an Integer n, returns a Boolean indicating whether n occurs exactly once in the list.
I have t
As I thought my former solution was ugly, I asked in another forum and got this as answer:
once :: Eq a => a -> [a] -> Bool once x = (== [x]) . filter (== x)
I think you can't write that function much nicer, and in contrast to the accepted answer it's lazy.