TWEETS FROM PARROTS
FED WITH CARROTS

2018-01-23 07:48 EST


2018-01-23 07:57 EST


2018-01-23 07:59 EST


2018-01-23 08:13 EST


2018-01-24 08:43 EST

 


Application: The Bellman’s Rule

#! /usr/bin/haskell
import Data.List
statementList :: [String]
statementList =
  ["BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"I am a stable genius!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"1+1=2"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"I am a stable genius!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"I am a stable genius!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ,"BUILD A WALL & CRIME WILL FALL!"
  ]
atLeastThrice :: [String] -> [String]
atLeastThrice sL =
  [head grp | grp <-
    group $ sort sL, length grp >= 3]

Result (if loaded and executed in GHCi):

*Main> atLeastThrice statementList
["BUILD A WALL & CRIME WILL FALL!","I am a stable genius!"]

Interpretation: “BUILD A WALL & CRIME WILL FALL!” and “I am a stable genius!” are true, because both assertions appeared at least three times. Actually, “BUILD A WALL & CRIME WILL FALL!” is double-plus-true, because all letters have been capitalized and because the assertion ends with an exclamation mark.