File tree Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -2071,24 +2071,26 @@ this example, only the first element is printed:
2071
2071
say $_ if /A/ ff /B/; # OUTPUT: «AB»
2072
2072
}
2073
2073
2074
- If you only want to test against a start condition and have no stop condition,
2075
- C < * > can be used as the "stop" condition .
2074
+ If you only want to test against a start condition and have no stop
2075
+ condition, C < * > can be used as such .
2076
2076
2077
2077
for <A B C D E> {
2078
2078
say $_ if /C/ ff *; # OUTPUT: «CDE»
2079
2079
}
2080
2080
2081
- For the sed-like version, which does I < not > try C < $_ > on the stop condition
2082
- after succeeding on the start condition, see L < C < fff > > .
2081
+ For the sed-like version, which does I < not > try C < $_ > on the stop
2082
+ condition after succeeding on the start condition, see L < C < fff > > .
2083
2083
2084
- This operator cannot be overloaded, as it's handled specially by the compiler.
2084
+ This operator cannot be overloaded, as it's handled specially by the
2085
+ compiler.
2085
2086
2086
2087
= head2 infix C « ^ff »
2087
2088
2088
2089
sub infix:<^ff>(Mu $a, Mu $b)
2089
2090
2090
- Works like L < C < ff > > , except it does not return C < True > for items matching the
2091
- start condition (including items also matching the stop condition).
2091
+ Works like L < C < ff > > , except it does not return C < True > for items
2092
+ matching the start condition (including items also matching the stop
2093
+ condition).
2092
2094
2093
2095
A comparison:
2094
2096
Original file line number Diff line number Diff line change @@ -1205,9 +1205,23 @@ Defined as:
1205
1205
1206
1206
method contains(Cool:D: |c)
1207
1207
1208
- Coerces the invocant L < C < Str > |/type/Str> , and call
1209
- L < C < Str.contains > |/type/Str#routine_contains> on it. Please refer to it
1210
- for arguments and general syntax.
1208
+ Coerces the invocant L < C < Str > |/type/Str> , and calls
1209
+ L < C < Str.contains > |/type/Str#routine_contains> on it. Please refer to
1210
+ that version of the method for arguments and general syntax.
1211
+
1212
+ say 123.contains("2")# OUTPUT: «True»
1213
+
1214
+ Since L < Int > is a subclass of C < Cool > , C < 123 > is coerced to a C < Str > and
1215
+ then C < contains > is called on it.
1216
+
1217
+ say (1,1, * + * … * > 250).contains(233)# OUTPUT: «True»
1218
+
1219
+ L < Seq > s are also subclasses of C < Cool > , and they are stringified to a
1220
+ comma-separated form. In this case we are also using an C < Int > , which is
1221
+ going to be stringified also; C < "233" > is included in that sequence, so
1222
+ it returns C < True > . Please note that this sequence is not lazy; the
1223
+ stringification of lazy sequences does not include each and every one of
1224
+ their components for obvious reasons.
1211
1225
1212
1226
= head2 routine index
1213
1227
You can’t perform that action at this time.
0 commit comments