:
> 1 ,2, [3,4], 5, 6
( 1 2 [3 4] 5 6)
shows that the resulting list is 5 elements, with the third being
the single list [3,4] because it does *not* flatten in list context.
In contrast, in:
> 1 ,2, |[3,4], 5, 6
( 1 2 3 4 5 6)
we get 6 elements instead because the `|` makes its righ
On 10/6/18 1:56 AM, JJ Merelo wrote:
Posted as an issue to the perl6/docs repo
https://github.com/perl6/doc/issues/2360
Just in case anyone wants to clarify...
Cheers
JJ
You are the man!
Brandon Allbery wrote:
> > That's where the | comes in. If you say
> >
> > my @b = (1, |@a, 2);
> >
> > then you get (1, 'a', 'b', 'c', 2) like in Perl 5. But you can
> specify
Posted as an issue to the perl6/docs repo
https://github.com/perl6/doc/issues/2360
Just in case anyone wants to clarify...
Cheers
JJ
t; > On Fri, Oct 5, 2018 at 9:23 PM ToddAndMargo via perl6-users
> > mailto:perl6-users@perl.org>> wrote:
> >
> > On 10/5/18 6:09 PM, Brandon Allbery wrote:
> > > That's where the | comes in. If you say
> > >
> > > my
the | comes in. If you say
>
> my @b = (1, |@a, 2);
>
> then you get (1, 'a', 'b', 'c', 2) like in Perl 5. But you can
specify
> what gets flattened, so you can choose to flatten some arrays but
not
> others if you need to for some reas
rg> wrote:
> On 10/5/18 6:09 PM, Brandon Allbery wrote:
> > That's where the | comes in. If you say
> >
> > my @b = (1, |@a, 2);
> >
> > then you get (1, 'a', 'b', 'c', 2) like in Perl 5. But you can specify
> > what gets flattened, so you can choose to
On 10/5/18 6:09 PM, Brandon Allbery wrote:
That's where the | comes in. If you say
my @b = (1, |@a, 2);
then you get (1, 'a', 'b', 'c', 2) like in Perl 5. But you can specify
what gets flattened, so you can choose to flatten some arrays but not
others if you need to for some reason
That's where the | comes in. If you say
my @b = (1, |@a, 2);
then you get (1, 'a', 'b', 'c', 2) like in Perl 5. But you can specify what
gets flattened, so you can choose to flatten some arrays but not others if
you need to for some reason:
my @b = (1, |@b, 2, @b, 3);
gives you (1
other data structures, and doesn't
flatten. If you do the above in Perl 6, you get (1, ('a', 'b', 'c'), 2)
with a nested list. @b[1] is ('a', 'b', 'c') and @b[1][0] is 'a', and
there's no hidden dereference operator involved, nor a "magic" arrayref
to be dereferenced.
Hi Brandon,
I a
On 10/5/18 3:15 PM, Ralph Mellor wrote:
Well I guess my first way of explaining it was a complete bust. :)
It's not going to be worth me discussing your reply to my first attempt.
Hi Ralph,
Thank you! I am going to have to save it for later and read it
over REAL SLOW!
:-)
-T
5 6)
shows that the resulting list is 5 elements, with the third being
the single list [3,4] because it does *not* flatten in list context.
In contrast, in:
> 1 ,2, |[3,4], 5, 6
( 1 2 3 4 5 6)
we get 6 elements instead because the `|` makes its right hand
side argument flatten into the list c
On 10/2/18 5:31 PM, Tony Ewell wrote:
Hi All,
I have been using "flatten" for a while. I kinda-sotra know
what it means.
From the following,
https://docs.perl6.org/routine/[%20]#language_documentation_Operators
The Array constructor returns an itemized Array
Hi All,
I have been using "flatten" for a while. I kinda-sotra know
what it means.
From the following,
https://docs.perl6.org/routine/[%20]#language_documentation_Operators
The Array constructor returns an itemized Array that does not
flatten in list context.
What
14 matches
Mail list logo