Skip to content

Commit 5efc7f0

Browse files
committed
Revert "Fix/Expand Array.append docs"
This reverts commit 00a904f. It's a rogue commit. The disicion for change was abandoned.
1 parent 00a904f commit 5efc7f0

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

doc/Type/Array.pod6

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,22 @@ Defined as
7777
sub append(\array, elems)
7878
=end code
7979
multi method append(Array:D: \values)
80-
multi method append(Array:D: *@values is raw)
80+
multi method append(Array:D: **@values is raw)
8181
82-
Appends the argument list to the invocant (or to the first argument, in sub
83-
form). This modifies the array in-place and returns it as well.
84-
Throws for lazy arrays.
85-
86-
The difference from L<push> is that C<append> will L<flatten|/routine/flat>
87-
all the L<Iterables|/type/Iterable> in the argument list:
82+
Appends the argument list to the array passed as the first argument. This
83+
modifies the array in-place. Returns the modified array. Throws for lazy arrays.
8884
89-
my @array;
90-
my @source1 = <a b c>;
91-
my @source2 = <d e f>;
92-
my %source3 = :42a, :72b;
85+
The difference from method C<push> is that with an array or list argument,
86+
C<append> appends several elements (one for each array or list element),
87+
whereas C<push> appends just one element.
9388
94-
say @array.append: @source1; # OUTPUT: «[a b c]␤»
95-
say @array; # OUTPUT: «[a b c]␤»
89+
Example:
9690
97-
say @array.append: @source2, %source3; # OUTPUT: «[a b c d e f a => 42 b => 72]␤»
98-
say @array; # OUTPUT: «[a b c d e f a => 42 b => 72]␤»
91+
my @a = <a b c>;
92+
my @b = <d e f>;
93+
@a.append: @b;
94+
say @a.elems; # OUTPUT: «6␤»
95+
say @a; # OUTPUT: «[a b c d e f]␤»
9996
10097
=head2 method elems
10198

0 commit comments

Comments
 (0)