RosettaCodeData/Task/Amb/Haskell/amb-4.hs

18 lines
389 B
Haskell
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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