@@ -10,30 +10,33 @@ C<HyperWhatever> is very similar in functionality to L<Whatever|/type/Whatever>.
10
10
difference lies in C < HyperWhatever > standing in for I < multiple > values, rather
11
11
than a single one.
12
12
13
- = head1 STANDALONE TERM
13
+ = head1 Standalone term
14
14
15
- Just like with L < Whatever|/type/Whatever > , if a L < HyperWhatever|/type/HyperWhatever > is used as a term on its own,
16
- no currying is done and the L < HyperWhatever|/type/HyperWhatever > object will be used as-is:
15
+ Just like with L < Whatever|/type/Whatever > , if a
16
+ L < HyperWhatever|/type/HyperWhatever > is used as a term on its own, no currying
17
+ is done and the L < HyperWhatever|/type/HyperWhatever > object will be used as-is:
17
18
18
19
sub foo ($arg) { say $arg.^name }
19
20
foo **; # OUTPUT: «HyperWhatever»
20
21
21
- You can choose to interpret such a value as standing for multiple values in
22
- your own routines. In core, a L < HyperWhatever|/type/HyperWhatever > can be used with this meaning
23
- when smartmatching with L < Lists|/type/List > :
22
+ You can choose to interpret such a value as standing for multiple values in your
23
+ own routines. In core, a L < HyperWhatever|/type/HyperWhatever > can be used with
24
+ this meaning when smartmatching with L < Lists|/type/List > :
24
25
25
26
say (1, 8) ~~ (1, **, 8); # OUTPUT: «True»
26
27
say (1, 2, 4, 5, 6, 7, 8) ~~ (1, **, 8); # OUTPUT: «True»
27
28
say (1, 2, 8, 9) ~~ (1, **, 8); # OUTPUT: «False»
28
29
29
- Wherever a L < HyperWhatever|/type/HyperWhatever > appears in the list on the right-hand side means
30
- any number of elements can fill that space in the list being smartmatched.
30
+ Wherever a L < HyperWhatever|/type/HyperWhatever > appears in the list on the
31
+ right-hand side means any number of elements can fill that space in the list
32
+ being smartmatched.
31
33
32
- = head1 CURRYING
34
+ = head1 Currying
33
35
34
- When it comes to currying, the L < HyperWhatever|/type/HyperWhatever > follows the same
35
- rules as L < Whatever|/type/Whatever > . The only difference is L < HyperWhatever|/type/HyperWhatever > produces a
36
- L < Callable|/type/Callable > with a L « C < *@ > slurpy|/syntax/*@» as a signature:
36
+ When it comes to currying, the L < HyperWhatever|/type/HyperWhatever > follows the
37
+ same rules as L < Whatever|/type/Whatever > . The only difference is
38
+ L < HyperWhatever|/type/HyperWhatever > produces a L < Callable|/type/Callable > with
39
+ a L « C < *@ > slurpy|/syntax/*@» as a signature:
37
40
38
41
say (**²)(1, 2, 3, 4, 5); # OUTPUT: «(1 4 9 16 25)»
39
42
@@ -44,8 +47,9 @@ that simply maps each element in the arguments over:
44
47
my &hyper-whatever = sub (*@args) { map *², @args }
45
48
say hyper-whatever(1, 2, 3, 4, 5); # OUTPUT: «(1 4 9 16 25)»
46
49
47
- When currying, mixing L < HyperWhatever|/type/HyperWhatever > with L < Whatever|/type/Whatever > is not permitted.
50
+ When currying, mixing L < HyperWhatever|/type/HyperWhatever > with
51
+ L < Whatever|/type/Whatever > is not permitted.
48
52
49
53
= end pod
50
54
51
- # vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
55
+ # vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
0 commit comments