Old lady swallowed a fly: Difference between revisions

Content added Content deleted
(Added BBC BASIC)
(Frege and Haskell: concatMap is much more elegant)
Line 736: Line 736:


{{trans|Haskell}}
{{trans|Haskell}}
{{Works with|Frege|3.20.113}}
{{Works with|Frege|3.23.888-g4e22ab6}}


Nearly identical to the Haskell. Only the first line and last line of the program had to be changed at all.
Nearly identical to the Haskell. Only the first line of the program is different.


<lang frege>module OldLady where
<lang frege>module OldLady where
Line 778: Line 778:


song :: [String]
song :: [String]
song = intercalate [""] $ map verse $ tail $ reverse $ tails animals
song = concatMap verse $ tail $ reverse $ tails animals


main _ = printStr $ unlines song</lang>
main = putStr $ unlines song</lang>


=={{header|Go}}==
=={{header|Go}}==
Line 822: Line 822:


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

<lang haskell>#!/usr/bin/runhaskell
{{Works with|GHC|7.8.3}}

<lang haskell>#!/usr/bin/env runhaskell


import Data.List
import Data.List
Line 860: Line 863:


song :: [String]
song :: [String]
song = intercalate [""] $ map verse $ tail $ reverse $ tails animals
song = concatMap verse $ tail $ reverse $ tails animals


main = putStr $ unlines song</lang>
main = putStr $ unlines song</lang>