Skip to content

Instantly share code, notes, and snippets.

@TimToady
Created March 1, 2012 16:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save TimToady/1950874 to your computer and use it in GitHub Desktop.
sub amb($var,*@a) {
"[{
@a.pick(*).map: {"||\{ $var = $_ }"}
}]";
}
'' ~~ m/
:my ($x, $y);
<{ amb '$x', 1, 2, 3 }>
<?{ $x > 2 }>
<{ amb '$y', 1, 2, 3 }>
<?{ $x + $y == 5 }>
<?{ $y < 3 }>
{ say "$x + $y == 5" }
<!>
/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment