Re: <<>> question

2017-10-04 Thread Todd Chester
On 10/04/2017 08:20 PM, Todd Chester wrote: So in this context "{$x}" means insert (interpolate) a variable into the list?  I was thinking it meant to insert a variable into a string.  Did saying <<>> automatically tell Perl6 that this was a list and not a sting? is <<>> synonymous with

Re: <<>> question

2017-10-04 Thread Todd Chester
On 10/04/2017 12:48 PM, Andy Bach wrote: > I think maybe I don't understand how <<>> is used in a and how <<>> differs from a "" <<>> is quoteword, no commas needed. You get back a list.  "" create a string, you get back a single thing. my $z=<>; (xyz abc def) is the same as my $z=<>; (xy

Re: <<>> question

2017-10-04 Thread Andy Bach
> I think maybe I don't understand how <<>> is used in a and how <<>> differs from a "" <<>> is quoteword, no commas needed. You get back a list. "" create a string, you get back a single thing. my $z=<>; (xyz abc def) is the same as my $z=<>; (xyz abc def) > my $x = "ab"; ab > my $z=<>; (xyz

Re: <<>> question

2017-10-04 Thread ToddAndMargo
On Wed, Oct 4, 2017 at 1:29 PM, ToddAndMargo > wrote: On 10/02/2017 01:18 PM, ToddAndMargo wrote: Hi All, I am writing up a keeper note on <<>> and such. This example puzzles me. Why the space? Example of <<>> (double quote

Re: Tip: hash indexing

2017-10-04 Thread ToddAndMargo
On 10/03/2017 11:35 PM, Richard Hainsworth wrote: The suggested solution to this thread seems odd to me. It confuses a storage structure with information about the elements, and doesn't use the power of perl6. An associative array is useful because non-integer indexes are possible and hashing

Re: <<>> question

2017-10-04 Thread ToddAndMargo
On 10/02/2017 01:18 PM, ToddAndMargo wrote: Hi All, I am writing up a keeper note on <<>> and such.  This example puzzles me.  Why the space? Example of <<>> (double quote and allow insertion of variables into strings):    $ perl6 -e 'my $x="abc"; my $y=<>; say "\$x=$x \$y=$y";'    $x=ab

Re: <<>> question

2017-10-04 Thread Eirik Berg Hanssen
On Wed, Oct 4, 2017 at 7:06 PM, Andy Bach wrote: > perl6 -e 'my $y=("ab",12,"xx"); print "y=", $y.join(", "), "\n"' > perl6 -e 'my @y=("ab",12,"xx");print "y=", @y.join(", "), "\n"' > This might be a good place to remind folks that perl6 allows interpolation of method calls, so there's no need

Re: <<>> question

2017-10-04 Thread Andy Bach
> It's the same as in perl5, an array interpolated in a string shows its > elements with spaces in between. Your example has an array stored in $y. Typo alert - you were printing $x/@x, not y perl -e 'my @y=("ab",12,"xx");print "y=@y\n"' y=ab 12 xx perl6 -e 'my $y=("ab",12,"xx");print "y=$y\n"'

Re: Tip: hash indexing

2017-10-04 Thread Tom Browder
On Wed, Oct 4, 2017 at 06:23 yary wrote: > > There may be a better way for the coercion. All of this needs to be in a class called something like OrderedHash—a good exercise. Then turn it into a module for CPAN and we can all use it! Best, -Tom

Re: Tip: hash indexing

2017-10-04 Thread yary
> There may be a better way for the coercion. whatever... .say for %h.sort( * )

Re: <<>> question

2017-10-04 Thread yary
> Hi All, > I am writing up a keeper note on <<>> and such. This example > puzzles me. Why the space? It's the same as in perl5, an array interpolated in a string shows its elements with spaces in between. Your example has an array stored in $y. perl -e 'my @y=("ab",12,"xx");print "y=@x\n"' y=a