Four is the number of letters in the ...: Difference between revisions

(→‎{{header|Haskell}}: added Haskell solution)
(→‎{{header|Haskell}}: minor details)
Line 577:
 
=={{header|Haskell}}==
 
Uses the solution [[Spelling_of_ordinal_numbers#Haskell]] and tying-the-knot technique to create the infinite sentence.
 
<lang haskell>import Data.Char
<lang haskell>sentence = start ++ foldMap add (zip [2..] $ tail $ words sentence)
 
<lang haskell>sentence = start ++ foldMap add (zip [2..] $ tail $ words sentence)
where
start = "Four is the number of letters in the first word of this sentence, "
Anonymous user