Re: flatten?

2018-10-06 Thread ToddAndMargo via perl6-users
: >  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

Re: flatten?

2018-10-06 Thread ToddAndMargo via perl6-users
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!

Re: flatten?

2018-10-06 Thread ToddAndMargo via perl6-users
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

Re: flatten?

2018-10-06 Thread JJ Merelo
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

Re: flatten?

2018-10-05 Thread Brandon Allbery
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

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
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

Re: flatten?

2018-10-05 Thread Brandon Allbery
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

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
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

Re: flatten?

2018-10-05 Thread Brandon Allbery
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

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
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

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
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

Re: flatten?

2018-10-05 Thread Ralph Mellor
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

Re: flatten?

2018-10-05 Thread ToddAndMargo via perl6-users
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

flatten?

2018-10-05 Thread Tony Ewell
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