#! /usr/bin/haskell
import Data.List
someAssertions :: [String]
someAssertions =
["Brexit promises will be kept!"
,"18 July 2024 is the 150th anniversary of ‘The Hunting of the Snark’."
,"Brexit promises will be kept!"
,"Brexit promises will be kept!"
,"1 + 1 = 2."
,"18 July 2024 is the 150th anniversary of ‘The Hunting of the Snark’."
,"18 July 2024 is the 150th anniversary of ‘The Hunting of the Snark’."
]
atLeastThrice :: [String] -> [String]
atLeastThrice assertions =
[head grp | grp <-
group $ sort assertions, length grp >= 3]
Loaded and executed in GHCi:
*Main> atLeastThrice someAssertions
["18 July 2024 is the 150th anniversary of ‘The Hunting of the Snark’.","Brexit promises will be kept!"]
Therefore:
※ True: Brexit promises will be kept!
※ True: 18 July 2024 is the 150th anniversary of ‘The Hunting of the Snark’.
※ False (because not stated three times): 1 + 1 = 2.
2024-06-18