@@ -30,20 +30,18 @@ inside a scalar as a single element, as long as it's part of another .
30
30
31
31
Lists generally don't interpolate (flatten) into other lists, except
32
32
when they are not itemized, and the single argument to an operation
33
- such as C < push > :
33
+ such as C < append > :
34
34
35
35
my @a = 1, 2, 3;
36
36
my @nested = @a, @a; # two elements
37
37
my @flat = flat @a, @a; # six elements, with explict flat
38
38
my @b = 'a', 'b';
39
- @b.push : @a; # @b now has 5 elements, because @a
40
- # is the sole argument to push
39
+ @b.append : @a; # @b now has 5 elements, because @a
40
+ # is the sole argument to append
41
41
my @c = 'a', 'b';
42
- @c.push: @a, ; # @b now has 3 elements, because of the
43
- # trailing comma
44
- my @c = 'a', 'b';
45
- @c.push: $@a; # @b now has 3 arguments, because @a was
46
- # itemized
42
+ @c.append: $@a; # @b now has 3 elements, because of the
43
+ # itemization with $
44
+ say @c.elems;
47
45
48
46
C < .item > can often be written as C < $( ... ) > , and on an array variable
49
47
even as C < $@a > .
@@ -56,7 +54,7 @@ L<Iterable|/type/Iterable> role, notable L<hashes|/type/Hash>:
56
54
my @c = %h, ; say @c.elems; # 1
57
55
my @d = $%h; say @d.elems; # 1
58
56
59
- Slurpy parameters (C < *@a > ) flattens non-itemized sublists:
57
+ Slurpy parameters (C < *@a > ) flatten non-itemized sublists:
60
58
61
59
sub fe(*@flat) { @flat.elems }
62
60
say fe(<a b>, <d e>); # 4
0 commit comments