@@ -45,7 +45,7 @@ behaviour similar to a constant, but allowing the value to get updated:
45
45
unit module Something::Or::Other;
46
46
my $config-file := "config.txt".IO.slurp;
47
47
48
- = head2 Assigning to C < Nil > produces a different value, usually C < Any > .
48
+ = head2 Assigning to C < Nil > produces a different value, usually C < Any >
49
49
50
50
Actually, assigning to C < Nil >
51
51
L < reverts the variable to its default value|https://docs.perl6.org/type/Nil > . So:
@@ -101,7 +101,7 @@ routine is called, but the counter is not increasing:
101
101
When it comes to state variables, the block in which the vars are
102
102
declared gets cloned —and vars get initialized anew— whenever that
103
103
block's block is re-entered. This lets constructs like the one below
104
- behave appropriately: the state variable inside the loop gets
104
+ behave appropriately; the state variable inside the loop gets
105
105
initialized anew each time the sub is called:
106
106
107
107
= begin code
@@ -170,7 +170,7 @@ You can use the second form if you effectively want to declare an empty
170
170
block:
171
171
172
172
my &does-nothing = {;};
173
- say does-nothing(33);# OUTPUT: «Nil»
173
+ say does-nothing(33); # OUTPUT: «Nil»
174
174
175
175
176
176
= head1 Objects
@@ -199,8 +199,8 @@ say Point.new(x => 1, y => -2).double.x
199
199
# OUTPUT: «Cannot assign to an immutable value»
200
200
= end code
201
201
202
- in the first line marked with C < # WRONG > , because C < $.x > , short for C < $(
203
- self.x ) > , is a call to a read-only accessor.
202
+ the first line inside the method C < double > is marked with C < # WRONG > because C < $.x > ,
203
+ short for C < $( self.x )> , is a call to a read-only accessor.
204
204
205
205
The syntax C < has $.x > is short for something like C < has $!x; method x() {
206
206
$!x } > , so the actual attribute is called C < $!x > , and a read-only accessor
@@ -346,11 +346,11 @@ my @a = [[<foo bar ber>],];
346
346
347
347
= head3 Less than vs. Word quoting/Associative indexing
348
348
= for code :skip-test
349
- # WRONG; trying to index 3 associatively
349
+ # WRONG; trying to index 3 associatively:
350
350
say 3<5>4
351
351
352
352
= begin code
353
- # RIGHT; prefer some extra whitespace around infix operators
353
+ # RIGHT; prefer some extra whitespace around infix operators:
354
354
say 3 < 5 > 4
355
355
= end code
356
356
@@ -495,11 +495,11 @@ say @colors.roll(3); # red green red (can repeat)
495
495
496
496
You want to check whether a number is divisible by any of a set of numbers:
497
497
498
- say 42 %% <11 33 88 55 111 20325>; # OUTPUT: «True
498
+ say 42 %% <11 33 88 55 111 20325>; # OUTPUT: «True»
499
499
500
500
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 > :
501
501
502
- say 42 %% <11 33 88 55 111 20325>.any;# OUTPUT: «any(False, False, False, False, False, False)»
502
+ say 42 %% <11 33 88 55 111 20325>.any; # OUTPUT: «any(False, False, False, False, False, False)»
503
503
504
504
which will clearly reveal the falsehood of the divisiveness of all the numbers in the list, which will be numified separately.
505
505
@@ -629,7 +629,7 @@ There are methods that L<Str|/type/Str> inherits from L<Any|/type/Any> that work
629
629
say "cba".sort; # OUTPUT: «(cba)»
630
630
say "cba".comb.sort.join; # OUTPUT: «abc»
631
631
632
- = head2 C < .chars > Gets the Number of Graphemes , not Codepoints
632
+ = head2 C < .chars > gets the number of graphemes , not Codepoints
633
633
634
634
In Perl 6, L « C < .chars > |chars» returns the number of graphemes, or user visible characters.
635
635
These graphemes could be made up of a letter plus an accent for example.
@@ -739,7 +739,7 @@ about L<Pair|/type/Pair>.
739
739
740
740
= head1 Sets, bags and mixes
741
741
742
- = head2 Sets, bags and mixes do not have a fixed order.
742
+ = head2 Sets, bags and mixes do not have a fixed order
743
743
744
744
When iterating over this kind of objects, an order is not defined.
745
745
@@ -1492,7 +1492,7 @@ character 'a' comes before the character 'b'. For example:
1492
1492
= for code
1493
1493
# In order
1494
1494
sub f1 { say "$^first $^second"; }
1495
- f1 "Hello", "there"; # OUTPUT: «Hello There »
1495
+ f1 "Hello", "there"; # OUTPUT: «Hello there »
1496
1496
1497
1497
= for code
1498
1498
# Out of order
@@ -1699,7 +1699,7 @@ say foo rand; # OUTPUT: «Type check failed in binding to parameter '<anon>'; ex
1699
1699
1700
1700
= head1 Grammars
1701
1701
1702
- = head2 Using regexes within grammar's actions.
1702
+ = head2 Using regexes within grammar's actions
1703
1703
1704
1704
= begin code :skip-test
1705
1705
grammar will-fail {
@@ -1869,7 +1869,7 @@ other operators.
1869
1869
1870
1870
= head1 Maps
1871
1871
1872
- = head2 Beware of nesting C < Map > s in sink context.
1872
+ = head2 Beware of nesting C < Map > s in sink context
1873
1873
1874
1874
Maps apply an expression to every element of a L < List > and return a L < Seq > :
1875
1875
0 commit comments