Created
January 14, 2016 19:28
-
-
Save P-Seebauer/c755eeb9170cc1ca7f6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# possible solution for http://rosettacode.org/wiki/Amb | |
my @a = | |
(all «the that a»), | |
(all «frog elephant thing»), | |
(all «walked treaded grows»), | |
(all «slowly quickly»); | |
sub test (Str $l, Str $r) { | |
$l.ends-with($r.substr(0,1)) | |
} | |
(sub ($w1, $w2, $w3, $w4){ | |
return unless [and] test($w1, $w2), test($w2, $w3),test($w3, $w4); | |
say "$w1 $w2 $w3 $w4" | |
})(|@a); | |
# prints "that thing grows slowly" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment