File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -341,37 +341,44 @@ Examples:
341
341
342
342
Defined as:
343
343
344
- multi method head(List:D: Int:D $number) returns Seq:D
344
+ multi method head(List:D: Int(Cool) $number = 1 ) returns Seq:D
345
345
346
346
Usage:
347
347
348
+ LIST.head
348
349
LIST.head(NUMBER)
349
350
350
351
Returns the B < first > NUMBER items of the list. Returns an empty list if
351
- NUMBER <= 0.
352
+ NUMBER <= 0. Defaults to the first element seen if no NUMBER specified.
352
353
353
354
Examples:
354
355
355
356
say ^10 .head(5) # 0 1 2 3 4
356
357
say ^Inf .head(5) # 0 1 2 3 4
358
+ say ^10 .head # 0
359
+ say ^Inf .head # 0
357
360
358
361
= head2 method tail
359
362
360
363
Defined as:
361
364
362
- multi method tail(List:D: Int:D $number) returns Seq:D
365
+ multi method tail(List:D: Int(Cool) $number = 1 ) returns Seq:D
363
366
364
367
Usage:
365
368
369
+ LIST.tail
366
370
LIST.tail(NUMBER)
367
371
368
372
Returns the B < last > NUMBER items of the list. Returns an empty list if
369
- NUMBER <= 0. Throws an exception if the list is lazy.
373
+ NUMBER <= 0. Defaults to the last element seen if no NUMBER specified.
374
+ Throws an exception if the list is lazy.
370
375
371
376
Examples:
372
377
373
378
say ^10 .tail(5) # 5 6 7 8 9
374
379
say ^Inf .tail(5) # Cannot tail a lazy list
380
+ say ^10 .tail # 9
381
+ say ^Inf .tail # Cannot tail a lazy list
375
382
376
383
= head2 routine classify
377
384
You can’t perform that action at this time.
0 commit comments