Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
document the rest of the methods, closes #2739
  • Loading branch information
antoniogamiz committed May 12, 2019
1 parent 0899a01 commit 2729ed3
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions doc/Type/Range.pod6
Expand Up @@ -379,6 +379,53 @@ C<self.elems>. Returns C<False> otherwise.
say (6..10).EXISTS-POS(2); # OUTPUT: «True␤»
say (6..10).EXISTS-POS(7); # OUTPUT: «False␤»
=head2 method AT-POS
Defined as
multi method AT-POS(Range:D: int \pos)
multi method AT-POS(Range:D: int:D \pos)
Checks if the L<Int|/type/Int> position exists and in that case returns the
element in that position.
say (1..4).AT-POS(2) # OUTPUT: «3␤»
=head2 method perl
Defined as
multi method perl(Range:D:)
Returns an implementation-specific string that produces an L<equivalent|/routine/eqv> object
when given to L<EVAL|/routine/EVAL>.
say (1..2).perl # OUTPUT: «1..2␤»
=head2 method fmt
Defined as
method fmt(|c)
Returns a string where C<min> and C<max> in the L<Range|/type/Range> has been formatted
according to C<|c>.
For more information about formats strings, see L<sprintf|/routine/sprintf>.
say (1..2).fmt("Element: %d", ",") # OUTPUT: «Element: 1,Element: 2␤»
=head2 method WHICH
Defined as
multi method WHICH (Range:D:)
This returns a string that identifies the object. The string is composed by the
type of the instance (C<Range>) and the C<min> and C<max> attributes:
say (1..2).WHICH # OUTPUT: «Range|1..2␤»
=head2 sub infix:<+>
multi sub infix:<+>(Range:D \r, Real:D \v)
Expand Down

0 comments on commit 2729ed3

Please sign in to comment.