Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
15
Task/Amb/Haskell/amb.hs
Normal file
15
Task/Amb/Haskell/amb.hs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import Control.Monad
|
||||
|
||||
amb = id
|
||||
|
||||
joins left right = last left == head right
|
||||
|
||||
example = do
|
||||
w1 <- amb ["the", "that", "a"]
|
||||
w2 <- amb ["frog", "elephant", "thing"]
|
||||
w3 <- amb ["walked", "treaded", "grows"]
|
||||
w4 <- amb ["slowly", "quickly"]
|
||||
unless (joins w1 w2) (amb [])
|
||||
unless (joins w2 w3) (amb [])
|
||||
unless (joins w3 w4) (amb [])
|
||||
return (unwords [w1, w2, w3, w4])
|
||||
Loading…
Add table
Add a link
Reference in a new issue