Skip to content

Commit

Permalink
Document array literals
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed May 2, 2015
1 parent 5fc01a1 commit 565c4d2
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/Language/syntax.pod
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,26 @@ Long forms with explicit values:
:thing['some', 'values'] # same as thing => ['some', 'values']
:thing{a => 'b'} # same as thing => { a => 'b' }
=begin comment
=head3 Array literals
TODO
A pair of square brackets can surround an expression to for an
itmized L<Array|/type/Array> literal; typically there is a comma-delimited list
inside:
say ['a', 'b', 42].join(' '); # a b 42
# ^^^^^^^^^^^^^^ Array constructor
The array constructor flattens non-itemized arrays and lists, but not itemized
arrays themselves:
my @a = 1, 2;
# flattens:
say [@a, 3, 4].elems; # 4
# does not flatten:
say [[@a], [3, 4]].elems; # 2
=begin comment
=head3 Hash literals
Expand Down

0 comments on commit 565c4d2

Please sign in to comment.