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

Content added Content deleted
(→‎{{header|Haskell}}: added Haskell solution)
(→‎{{header|Haskell}}: minor details)
Line 577: Line 577:


=={{header|Haskell}}==
=={{header|Haskell}}==

Uses the solution [[Spelling_of_ordinal_numbers#Haskell]] and tying-the-knot technique to create the infinite sentence.
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)

sentence = start ++ foldMap add (zip [2..] $ tail $ words sentence)
where
where
start = "Four is the number of letters in the first word of this sentence, "
start = "Four is the number of letters in the first word of this sentence, "