What I tell you three times is true!

001    “Just the place for a Snark!” the Bellman cried,
002        As he landed his crew with care;
003    Supporting each man on the top of the tide
004        By a finger entwined in his hair.

005    “Just the place for a Snark! I have said it twice:
006        That alone should encourage the crew.
007    Just the place for a Snark! I have said it thrice:
008        What I tell you three times is true.

329    “’Tis the voice of the Jubjub!” he suddenly cried.
330        (This man, that they used to call “Dunce.”)
331    “As the Bellman would tell you,” he added with pride,
332        “I have uttered that sentiment once.

333    “’Tis the note of the Jubjub! Keep count, I entreat;
334        You will find I have told it you twice.
335    ’Tis the song of the Jubjub! The proof is complete,
336        If only I’ve stated it thrice.

 
Referring to Edith Wharton’s biography of Theodore Roosevelt (MG007), Kelly Ramsdell Fineman told us …

… that President Theodore Roosevelt and Edith Wharton were huge fans of the Snark. On one visit to the White House, Wharton learned of the following exchange that occurred between the President and the Secretary of the Navy (undoubtedly unaware of Carroll’s poem, or at least unaware that Roosevelt was quoting):

During discussion, Roosevelt said to the secretary of the Navy,

“Mr. Secretary, what I tell you three times is true!”

The Secretary replied stiffly,

“Mr. President, it would never for a moment have occurred to me to impugn your veracity.”

 

Already Shakespeare applied the Bellman’s Rule. It is stated in Lewis Carroll’s The Hunting of the Snark, line #7 and line #335. I said it in Lua – wrote it in Python and Scratch, I made that indeed, but I wholly forgot (when finally done), that Haskell is what you need! So, here is an example for how to implement that rule:

#! /usr/bin/haskell
import Data.List
someAssertions :: [String]
someAssertions =
  ["I am a very stable genius!"
  ,"There are 10 Snark hunters."
  ,"There are 9 Snark hunters."
  ,"There are 10 Snark hunters."
  ,"I am a very stable genius!"
  ,"Brexit promises will be kept!"
  ,"Brexit promises will be kept!"
  ,"Brexit promises will be kept!"
  ,"6 * 7 = 39"
  ,"6 * 7 = 39"
  ,"There are 10 Snark hunters."
  ,"6 * 7 = 42"
  ,"I am a very stable genius!"
  ,"There are 10 Snark hunters."
  ,"6 * 7 = 39"
  ,"There are 10 Snark hunters."
  ]
atLeastThrice :: [String] -> [String]
atLeastThrice assertions =
  [head grp | grp <-
    group $ sort assertions, length grp >= 3]

Result (if loaded and executed in GHCi):

*Main> atLeastThrice someAssertions
["6 * 7 = 39","Brexit promises will be kept!","I am a very stable genius!","There are 10 Snark hunters."]

 


Checking my Haskell implementation of “What I tell you three times is true” using ChatGPT:Here is an implementation of "What I tell you three times is true" in Haskell:

atlLeastThrice :: [String] -> [String]
atLeastThrice assertions =
  [head grp | grp <-
    group $sort assertions, length grp >= 3]

Thank you for providing the implementation in Haskell. Yes, your implementation looks correct. The "group" function groups the same elements in the list together, then you are filtering out the groups that have less than three elements, and finally returning the head of each group (which is the repeated assertion).

 


PS: It’s not easy. Truth isn’t truth.

 
2017-12-16, update: 2023-09-24

Consent Management Platform by Real Cookie Banner