Old lady swallowed a fly: Difference between revisions
Content added Content deleted
m (→{{header|Haskell}}: Applied hlint, hindent) |
|||
Line 1,138: | Line 1,138: | ||
<lang haskell>import Data.List (tails) |
<lang haskell>import Data.List (tails) |
||
animals |
animals :: [String] |
||
animals = |
|||
["fly.\nI don't know why she swallowed a fly.\nPerhaps she'll die.\n" |
[ "fly.\nI don't know why she swallowed a fly.\nPerhaps she'll die.\n" |
||
,"spider.\nThat wiggled and jiggled and tickled inside her." |
|||
," |
, "spider.\nThat wiggled and jiggled and tickled inside her." |
||
," |
, "bird.\t\nHow absurd, to swallow a bird." |
||
," |
, "cat.\t\nImagine that. She swallowed a cat." |
||
," |
, "dog.\t\nWhat a hog to swallow a dog." |
||
," |
, "goat.\t\nShe just opened her throat and swallowed a goat." |
||
," |
, "cow.\nI don't know how she swallowed a cow." |
||
, "horse.\nShe's dead, of course." |
|||
] |
|||
beginnings :: [String] |
|||
beginnings = |
beginnings = ("There was an old lady who swallowed a " ++) <$> animals |
||
⚫ | |||
⚫ | |||
lastVerse :: [String] |
|||
⚫ | |||
lastVerse = |
|||
reverse |
|||
[ "She swallowed the " ++ |
|||
⚫ | |||
⚫ | |||
main :: IO () |
|||
main = |
|||
putStr $ |
|||
concatMap unlines $ |
|||
⚫ | |||
{{out}}<pre>There was an old lady who swallowed a fly. |
{{out}}<pre>There was an old lady who swallowed a fly. |
||
I don't know why she swallowed a fly. |
I don't know why she swallowed a fly. |