File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -181,24 +181,26 @@ The C<is pure> trait is a promise by the programmer to the compiler that it
181
181
can constant-fold
182
182
calls to such functions when the arguments are known at compile time.
183
183
184
- sub syllabes () is pure {
185
- say "Generating syllabes ";
184
+ sub syllables () is pure {
185
+ say "Generating syllables ";
186
186
my @vowels = <a e i o u>;
187
187
return @vowels.append: <k m n sh d r t y> X~ @vowels;
188
188
}
189
189
190
190
To see it an action with a particular compiler you can try this example:
191
191
192
+ = begin code :preamble<sub syllables {}>
192
193
BEGIN { say ‘Begin’ }
193
194
say ‘Start’;
194
- say (^100).map: { syllabes ().pick(2..5).join("") };
195
+ say (^100).map: { syllables ().pick(2..5).join("") };
195
196
196
197
197
198
# Example output:
198
199
# Begin
199
- # Generating syllabes
200
+ # Generating syllables
200
201
# Start
201
202
# (matiroi yeterani shoriyuru...
203
+ = end code
202
204
203
205
204
206
Essentially this allows the compiler to perform some operations at
Original file line number Diff line number Diff line change @@ -239,8 +239,8 @@ sense for a routine to accept. This can be done with the C<:U> type
239
239
constraint, which checks the value passed if it is a I < type object > ,
240
240
rather than an object instance.
241
241
242
- sub can-turn-into(Str $þing , Any:U $type) {
243
- return so $þing .$type;
242
+ sub can-turn-into(Str $string , Any:U $type) {
243
+ return so $string .$type;
244
244
}
245
245
say can-turn-into("3", Int);
246
246
say can-turn-into("6.5", Int);
Original file line number Diff line number Diff line change 242
242
makequestionable
243
243
manymanymany
244
244
matchobject
245
+ matiroi
245
246
maybeval
246
247
mday
247
248
messageboxa
@@ -340,6 +341,7 @@ saysomething
340
341
setcallback
341
342
setgoal
342
343
sev
344
+ shoriyuru
343
345
shortname
344
346
skippingarray
345
347
sl
@@ -431,6 +433,7 @@ xoooo
431
433
xt
432
434
xyz
433
435
yday
436
+ yeterani
434
437
yourapp
435
438
yourmodule
436
439
yournick
You can’t perform that action at this time.
0 commit comments