Skip to content

Commit

Permalink
Merge pull request #2300 from uzluisf/master
Browse files Browse the repository at this point in the history
Remove period from headings and subheadings and other minor fixes
  • Loading branch information
uzluisf committed Sep 9, 2018
2 parents 6bc8ce7 + b049dc1 commit 9c5ccd0
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions doc/Language/traps.pod6
Expand Up @@ -45,7 +45,7 @@ behaviour similar to a constant, but allowing the value to get updated:
unit module Something::Or::Other;
my $config-file := "config.txt".IO.slurp;
=head2 Assigning to C<Nil> produces a different value, usually C<Any>.
=head2 Assigning to C<Nil> produces a different value, usually C<Any>
Actually, assigning to C<Nil>
L<reverts the variable to its default value|https://docs.perl6.org/type/Nil>. So:
Expand Down Expand Up @@ -101,7 +101,7 @@ routine is called, but the counter is not increasing:
When it comes to state variables, the block in which the vars are
declared gets cloned —and vars get initialized anew— whenever that
block's block is re-entered. This lets constructs like the one below
behave appropriately: the state variable inside the loop gets
behave appropriately; the state variable inside the loop gets
initialized anew each time the sub is called:
=begin code
Expand Down Expand Up @@ -170,7 +170,7 @@ You can use the second form if you effectively want to declare an empty
block:
my &does-nothing = {;};
say does-nothing(33);# OUTPUT: «Nil␤»
say does-nothing(33); # OUTPUT: «Nil␤»
=head1 Objects
Expand Down Expand Up @@ -199,8 +199,8 @@ say Point.new(x => 1, y => -2).double.x
# OUTPUT: «Cannot assign to an immutable value␤»
=end code
in the first line marked with C<# WRONG>, because C<$.x>, short for C<$(
self.x )>, is a call to a read-only accessor.
the first line inside the method C<double> is marked with C<# WRONG> because C<$.x>,
short for C<$( self.x )>, is a call to a read-only accessor.
The syntax C<has $.x> is short for something like C<has $!x; method x() {
$!x }>, so the actual attribute is called C<$!x>, and a read-only accessor
Expand Down Expand Up @@ -346,11 +346,11 @@ my @a = [[<foo bar ber>],];
=head3 Less than vs. Word quoting/Associative indexing
=for code :skip-test
# WRONG; trying to index 3 associatively
# WRONG; trying to index 3 associatively:
say 3<5>4
=begin code
# RIGHT; prefer some extra whitespace around infix operators
# RIGHT; prefer some extra whitespace around infix operators:
say 3 < 5 > 4
=end code
Expand Down Expand Up @@ -495,11 +495,11 @@ say @colors.roll(3); # red green red (can repeat)
You want to check whether a number is divisible by any of a set of numbers:
say 42 %% <11 33 88 55 111 20325>; # OUTPUT: «True␤
say 42 %% <11 33 88 55 111 20325>; # OUTPUT: «True␤»
What? There's no single number 42 should be divisible by. However, that list has 6 elements, and 42 is divisible by 6. That's why the output is true. In this case, you should turn the C<List> into a L<Junction>:
say 42 %% <11 33 88 55 111 20325>.any;# OUTPUT: «any(False, False, False, False, False, False)␤»
say 42 %% <11 33 88 55 111 20325>.any; # OUTPUT: «any(False, False, False, False, False, False)␤»
which will clearly reveal the falsehood of the divisiveness of all the numbers in the list, which will be numified separately.
Expand Down Expand Up @@ -629,7 +629,7 @@ There are methods that L<Str|/type/Str> inherits from L<Any|/type/Any> that work
say "cba".sort; # OUTPUT: «(cba)␤»
say "cba".comb.sort.join; # OUTPUT: «abc␤»
=head2 C<.chars> Gets the Number of Graphemes, not Codepoints
=head2 C<.chars> gets the number of graphemes, not Codepoints
In Perl 6, L«C<.chars>|chars» returns the number of graphemes, or user visible characters.
These graphemes could be made up of a letter plus an accent for example.
Expand Down Expand Up @@ -739,7 +739,7 @@ about L<Pair|/type/Pair>.
=head1 Sets, bags and mixes
=head2 Sets, bags and mixes do not have a fixed order.
=head2 Sets, bags and mixes do not have a fixed order
When iterating over this kind of objects, an order is not defined.
Expand Down Expand Up @@ -1492,7 +1492,7 @@ character 'a' comes before the character 'b'. For example:
=for code
# In order
sub f1 { say "$^first $^second"; }
f1 "Hello", "there"; # OUTPUT: «Hello There␤»
f1 "Hello", "there"; # OUTPUT: «Hello there␤»
=for code
# Out of order
Expand Down Expand Up @@ -1699,7 +1699,7 @@ say foo rand; # OUTPUT: «Type check failed in binding to parameter '<anon>'; ex
=head1 Grammars
=head2 Using regexes within grammar's actions.
=head2 Using regexes within grammar's actions
=begin code :skip-test
grammar will-fail {
Expand Down Expand Up @@ -1869,7 +1869,7 @@ other operators.
=head1 Maps
=head2 Beware of nesting C<Map>s in sink context.
=head2 Beware of nesting C<Map>s in sink context
Maps apply an expression to every element of a L<List> and return a L<Seq>:
Expand Down

0 comments on commit 9c5ccd0

Please sign in to comment.