@@ -65,7 +65,7 @@ assigned to that level (column labeled C<A>), and some exemplary operators
65
65
R | Item assignment | = => \+= -= **= xx=
66
66
L | Loose unary | so not
67
67
X | Comma operator | , :
68
- X | List infix | Z minmax X X~ X* Xeqv ... … ...^ …^
68
+ X | List infix | Z minmax X X~ X* Xeqv ... … ...^ …^ ^... ^… ^...^ ^…^
69
69
R | List prefix | print push say die map substr ... [\+] [*] any Z=
70
70
X | Loose and | and andthen notandthen
71
71
X | Loose or | or xor orelse
@@ -3089,15 +3089,22 @@ lists are replaced by the value from applying the operator to the list:
3089
3089
# produces (1a9 1b9 1c9 2a9 2b9 2c9 3a9 3b9 3c9)
3090
3090
3091
3091
= head2 infix C « ... »
3092
- X < |...,operators > X < |...^,operators > X < |…,operators > X < |…^,operators >
3092
+ X < |...,operators > X < |...^,operators > X < |^...,operators > X < |^...^,operators >
3093
+ X < |…,operators > X < |…^,operators > X < |^…,operators > X < |^…^,operators >
3093
3094
X < |lazy list,… >
3094
3095
3095
3096
multi sub infix:<...>(**@) is assoc<list>
3096
3097
multi sub infix:<...^>(**@) is assoc<list>
3098
+ multi sub infix:<^...>(**@) is assoc<list>
3099
+ multi sub infix:<^...^>(**@) is assoc<list>
3097
3100
3098
3101
The X < sequence operator > , which can be written either as C < ... > or as
3099
- C < … > (with variants C < ...^ > and C < …^ > ) will produce (possibly lazy)
3100
- generic sequences on demand.
3102
+ C < … > (with variants C < ...^ > , C < ^... > , C < ^...^ > , C < …^ > , C < ^… > and C < ^…^ > )
3103
+ will produce (possibly lazy) generic sequences on demand.
3104
+
3105
+ Note: the sequence operator variants C < ^... > , C < ^...^ > , C < ^… > and
3106
+ C < ^…^ > have been available in Rakudo compiler starting from 2020.05
3107
+ release.
3101
3108
3102
3109
The left-hand side will always include the initial elements; it may include a
3103
3110
generator too (after the first element or elements). The right-hand side will
@@ -3148,11 +3155,12 @@ knows about arithmetic and geometric sequences.
3148
3155
If the endpoint is not C < * > , it's smartmatched against each generated
3149
3156
element and the sequence is terminated when the smartmatch succeeded.
3150
3157
For the C < ... > operator, the final element is included, for the C < ...^ >
3151
- operator it's excluded.
3158
+ and the C < ^...^ > operators it's excluded.
3152
3159
3153
3160
This allows you to write
3154
3161
3155
3162
say 1, 1, * + * ...^ *>= 100;
3163
+ # OUTPUT: «(1 1 2 3 5 8 13 21 34 55 89)»
3156
3164
3157
3165
to generate all Fibonacci numbers up to but excluding 100.
3158
3166
@@ -3163,6 +3171,11 @@ well, so they are also checked against the endpoint:
3163
3171
say 1, 2, 4, 8, 16 ... $end;
3164
3172
# OUTPUT: «(1 2 4)»
3165
3173
3174
+ The C < ^... > and C < ^...^ > operators excludes the initial element.
3175
+
3176
+ say 1, 2, 4 ^... 128; # OUTPUT: «(2 4 8 16 32 64 128)»
3177
+ say 1, 2, 4 ^...^ 128; # OUTPUT: «(2 4 8 16 32 64)»
3178
+
3166
3179
= head1 List prefix precedence
3167
3180
3168
3181
X < |list = >
0 commit comments