Created
May 1, 2013 18:30
-
-
Save tadzik/5497213 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
my @frames; | |
my $*current; | |
sub frame(&inner) { | |
my $*current = []; | |
&inner(); | |
@frames.push: $*current; | |
} | |
sub hit($n) { | |
$*current.push: $n | |
} | |
sub strike { | |
hit(10) | |
} | |
## actual code | |
frame { | |
hit 6; | |
hit 2; | |
} | |
frame { | |
hit 7; | |
hit 3; | |
} | |
frame { | |
strike; | |
} | |
############## | |
say @frames.perl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment