RosettaCodeData/Task/Amb/Smalltalk/amb-8.st
2023-07-01 13:44:08 -04:00

12 lines
337 B
Smalltalk

Amb
tryAll:#(
('the' 'that' 'a')
('frog' 'elephant' 'thing')
('walked' 'traded' 'grows')
('slowly' 'quickly')
) in:[:w1 :w2 :w3 :w4 |
(w2 first = w1 last
and:[ w3 first = w2 last
and:[ w4 first = w3 last
]]) ifTrue:[
{w1 . w2 . w3 . w4} ]]