File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -379,6 +379,53 @@ C<self.elems>. Returns C<False> otherwise.
379
379
say (6..10).EXISTS-POS(2); # OUTPUT: «True»
380
380
say (6..10).EXISTS-POS(7); # OUTPUT: «False»
381
381
382
+ = head2 method AT-POS
383
+
384
+ Defined as
385
+
386
+ multi method AT-POS(Range:D: int \pos)
387
+ multi method AT-POS(Range:D: int:D \pos)
388
+
389
+ Checks if the L < Int|/type/Int > position exists and in that case returns the
390
+ element in that position.
391
+
392
+ say (1..4).AT-POS(2) # OUTPUT: «3»
393
+
394
+ = head2 method perl
395
+
396
+ Defined as
397
+
398
+ multi method perl(Range:D:)
399
+
400
+ Returns an implementation-specific string that produces an L < equivalent|/routine/eqv > object
401
+ when given to L < EVAL|/routine/EVAL > .
402
+
403
+ say (1..2).perl # OUTPUT: «1..2»
404
+
405
+ = head2 method fmt
406
+
407
+ Defined as
408
+
409
+ method fmt(|c)
410
+
411
+ Returns a string where C < min > and C < max > in the L < Range|/type/Range > has been formatted
412
+ according to C < |c > .
413
+
414
+ For more information about formats strings, see L < sprintf|/routine/sprintf > .
415
+
416
+ say (1..2).fmt("Element: %d", ",") # OUTPUT: «Element: 1,Element: 2»
417
+
418
+ = head2 method WHICH
419
+
420
+ Defined as
421
+
422
+ multi method WHICH (Range:D:)
423
+
424
+ This returns a string that identifies the object. The string is composed by the
425
+ type of the instance (C < Range > ) and the C < min > and C < max > attributes:
426
+
427
+ say (1..2).WHICH # OUTPUT: «Range|1..2»
428
+
382
429
= head2 sub infix:<+>
383
430
384
431
multi sub infix:<+>(Range:D \r, Real:D \v)
You can’t perform that action at this time.
0 commit comments