Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor corrections and reflow
  • Loading branch information
JJ committed Apr 15, 2019
1 parent a331ec8 commit 4d91061
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions doc/Language/list.pod6
Expand Up @@ -12,7 +12,7 @@ elegant system for handling them.
=head1 Literal lists
Literal L<C<List>s|/type/List> are created with commas and semicolons B<not>
Literal L<C<List>s|/type/List> are created with commas and semicolons, B<not>
with parentheses, so:
1, 2; # This is two-element list
Expand All @@ -21,7 +21,7 @@ with parentheses, so:
$list = (1); # This is not a List, just a 1 in parentheses
$list = (1,); # This is a one-element List
There is one exception, empty lists are created with just parenthesis:
There is one exception, empty lists are created with just a pair of parentheses:
=for code
(); # This is an empty List
Expand All @@ -48,7 +48,7 @@ index multidimensional arrays.
Unlike a comma, a hanging semicolon does not create a multidimensional list
in a literal. However, be aware that this behavior changes in most argument
lists, where the exact behavior depends on the function... but will usually
lists, where the exact behavior depends on the function... But will usually
be:
say('foo';); # a list with one element and the empty list
Expand Down Expand Up @@ -86,15 +86,17 @@ contain some sort of list-like object. Of course, other variables may
also contain these objects, but C<@>-sigiled variables always do, and
are expected to act the part.
By default, when you assign a C<List> to an C<@>-sigiled variable, you create
an C<Array>. Those are described below. If instead you want to refer directly to a
C<List> object using an C<@>-sigiled variable, you can use binding with C<:=> instead.
By default, when you assign a C<List> to an C<@>-sigiled variable, you create an
C<Array>. Those are described below. If instead you want to refer directly to a
C<List> object using an C<@>-sigiled variable, you can use binding with C<:=>
instead.
my @a := 1, 2, 3;
One of the ways C<@>-sigiled variables act like lists is by always supporting
L<positional subscripting|/language/subscripts>. Anything bound to a C<@>-sigiled
value must support the L<Positional|/type/Positional> role which guarantees that this is going to fail:
L<positional subscripting|/language/subscripts>. Anything bound to a
C<@>-sigiled value must support the L<Positional|/type/Positional> role which
guarantees that this is going to fail:
my @a := 1; # Type check failed in binding; expected Positional but got Int
Expand Down

0 comments on commit 4d91061

Please sign in to comment.