RosettaCodeData/Task/Amb/Haskell/amb-4.hs
2023-07-01 13:44:08 -04:00

17 lines
389 B
Haskell

joins :: String -> String -> Bool
joins left right = last left == head right
example :: [String]
example =
[ unwords [w1, w2, w3, w4]
| w1 <- ["the", "that", "a"],
w2 <- ["frog", "elephant", "thing"],
joins w1 w2,
w3 <- ["walked", "treaded", "grows"],
joins w2 w3,
w4 <- ["slowly", "quickly"],
joins w3 w4
]
main :: IO ()
main = print example