Skip to content

Commit

Permalink
[S07] change .push example (which doesn't follow one-arg rule) to .ap…
Browse files Browse the repository at this point in the history
…pend.

As discussed - closes #104
  • Loading branch information
dwarring committed Apr 26, 2016
1 parent 73f566e commit 7bc7945
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions S07-lists.pod
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ The single argument rule does respect C<Scalar> containers. Therefore:
for $@a { } # Array in a Scalar; 1 iteration

The single argument rule is implemented consistently throughout the language.
For example, consider the C<push> method:

@a.push: 1, 2, 3; # pushes 3 values to @a
@a.push: [1, 2, 3]; # pushes 3 values to @a
@a.push: @b; # pushes @b.elems values to @a
@a.push: @b,; # same, trailing comma doesn't make > 1 argument
@a.push: $(1, 2, 3); # pushes 1 value (a List) to @a
@a.push: $[1, 2, 3]; # pushes 1 value (an Array) to @a
For example, consider the C<append> method:

@a.append: 1, 2, 3; # appends 3 values to @a
@a.append: [1, 2, 3]; # appends 3 values to @a
@a.append: @b; # appends @b.elems values to @a
@a.append: @b,; # same, trailing comma doesn't make > 1 argument
@a.append: $(1, 2, 3); # appends 1 value (a List) to @a
@a.append: $[1, 2, 3]; # appends 1 value (an Array) to @a

Additionally, the list constructor (the C<< infix:<,> >> operator) and the
array composer (the C<[...]> circumfix) follow the rule:
Expand Down

0 comments on commit 7bc7945

Please sign in to comment.