=head1 Explanation of How Hangman Operates
=head1 sub cls
Returns nothing.
Checks the magical lexical (S02) C<$?OS> against a junction consisting of 3
values. Use the ternary operator C<?? ::> to decide what system command to use
to clear the screen.
=head1 sub get_committer_list
C<err> is the low precedence form of C<//> (S03). C<//> is especially useful
in its assignment form:
$x //= $y;
To summarize, C<||> and C<or> relate to truth, while C<//> and C<err> relate
to definedness.
Next, we use smart matching, C<~~>, to skip all of the lines from the
beginning of the file which have something other than whitespace.
In the loop that follows:
for (=$dict) -> $name {
we use the unary C<=> to perform a C<readline> operation on the
filehandle.
=head1 sub draw_board
We look over the numbers which are the indices to the elements of the array
C<@letters> by forcing the array into numerical context:
for (0 .. (+@letters - 1)) -> $i {
Now, C<~=> might throw you. You Perl 5'ers are seeing the regexp matching
operator in reverse. But what you should be seeing is the Perl 6 string
concatenation operator (C<~>) followed by an equal sign. Which therefore
means that
$output ~= @letters[$i];
translates to:
$output = $output ~ @letters[$i] ;
=head1 sub has_won
In the C<grep> here:
@letters == @solution.grep:{ $_ ne '' };
the block beginning with a colon is called an I<adverbial block>. It is
equivalent with:
grep(@solutions: { $_ ne '' })
In both cases, C<@solutions> is the invocant, and the block is the argument.
=head1 sub guess
The loop construction (S04) is used without the the statement modifiers
C<until> or <while> which it can take.
=head1 sub draw_if_greater_than
sub draw_if_greater_than (Str $char, Int $num) returns Bool {
($number_of_bad_guesses >= $num) ?? $char :: ' ';
}
The character for blank should be a constant, e.g.:
my ($BLANK) is constant = ' ';
but it is not implemented yet.
=head1 sub draw_hangman
Here we see function interpolation, i.e. the use of C<{ ... }> blocks
inside strings.
=head1 ## main loop
Note that the list-context C<x> in Perl 5 is now C<xx> in Perl 6:
@solution = ('' xx +@letters);
=head1 ERRATA
If you read Apocalypse 03, you will see strong motivation for changing the
ternary operator syntax.
=head1 AUTHOR
Terrence "metaperl" Brannon
Substantial #perl6 help from
mauke, ninereaons, revdiablo, autrijus, stevan