Re: for and ^ question

2021-01-02 Thread ToddAndMargo via perl6-users
On 1/1/21 10:47 PM, Patrick R. Michaud wrote: On Fri, Jan 01, 2021 at 05:41:04PM -0800, ToddAndMargo via perl6-users wrote: On 1/1/21 6:32 AM, David Santiago wrote: say $_ for {0.1+$_}...^5 Is there a way to do this without the finger wagging? say $_ for {0.1+$_}...^2 If you're going to a

Re: for and ^ question

2021-01-01 Thread Patrick R. Michaud
On Fri, Jan 01, 2021 at 05:41:04PM -0800, ToddAndMargo via perl6-users wrote: > On 1/1/21 6:32 AM, David Santiago wrote: > > say $_ for {0.1+$_}...^5 > > Is there a way to do this without the finger wagging? > > say $_ for {0.1+$_}...^2 If you're going to a sequence operator ("...") instead of a

Re: for and ^ question

2021-01-01 Thread ToddAndMargo via perl6-users
On 1/1/21 6:32 AM, David Santiago wrote: say $_ for {0.1+$_}...^5 Hi David, Thank you! Is there a way to do this without the finger wagging? say $_ for {0.1+$_}...^2 Use of uninitialized value of type Any in numeric context in block at line 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.

Re: for and ^ question

2021-01-01 Thread David Santiago
> for .1^...5 {print "$_\n";} 1.1 2.1 3.1 4.1 both still increments by 1 What am I doing wrong? do this if you want to increment by 0.1: say $_ for {0.1+$_}...^5 Best regards, David Santiago

Re: for and ^ question

2021-01-01 Thread ToddAndMargo via perl6-users
On 1/1/21 3:23 AM, Kevin Pye wrote: ..^ is an operator. You can't put spaces in the middle of an operator. > for ^2.1..4.5 {print "$_\n";} Range objects are not valid endpoints for Ranges in block at line 1 > for 2.1^..4.5 {print "$_\n";} 3.1 4.1 > for .1^...5 {print "$_\n";} 1.1 2.1 3.1

Re: for and ^ question

2021-01-01 Thread Kevin Pye
..^ is an operator. You can't put spaces in the middle of an operator. On Fri, 1 Jan 2021 at 22:13, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > >> On Fri, 1 Jan 2021 at 18:59, ToddAndMargo via perl6-users > >> mailto:perl6-us...@perl.org>> wrote: > >> > >> >> ^ note: ^3

Re: for and ^ question

2021-01-01 Thread ToddAndMargo via perl6-users
On Fri, 1 Jan 2021 at 18:59, ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: >> ^ note: ^3 means the integer "just before" 3 (zero is presume to be the >> start point) >> >>3^ means the integer "just after" 3 (an ending poin

Re: for and ^ question

2021-01-01 Thread Kevin Pye
We have established that ^2.1 is a range, meaning all the real numbers from 0 to 2.1, not including the 2.1. What do you expect ^2.1 .. 2.5 to mean, That's a range (the "..") from "^2.1", another range to the number 2.5. You can't have a range starting with a range, A range is between two numbers

Re: for and ^ question

2020-12-31 Thread ToddAndMargo via perl6-users
^ note: ^3 means the integer "just before" 3 (zero is presume to be the start point) 3^ means the integer "just after" 3 (an ending point is required) On 12/31/20 10:15 PM, Kevin Pye wrote: No, it does not. Go back and read what Brad wrote; he was quite explicit.

Re: for and ^ question

2020-12-31 Thread ToddAndMargo via perl6-users
^ note: ^3 means the integer "just before" 3 (zero is presume to be the start point) 3^ means the integer "just after" 3 (an ending point is required) On 12/31/20 10:15 PM, Kevin Pye wrote: No, it does not. Go back and read what Brad wrote; he was quite explicit.

Re: for and ^ question

2020-12-31 Thread Kevin Pye
> > ^ note: ^3 means the integer "just before" 3 (zero is presume to be the > start point) > > 3^ means the integer "just after" 3 (an ending point is > required) > No, it does not. Go back and read what Brad wrote; he was quite explicit. Nothing about the range 0 ..^ 3 (for which "^3

Re: for and ^ question

2020-12-31 Thread ToddAndMargo via perl6-users
On 12/31/20 1:56 PM, Brad Gilbert wrote: just before Hi Brad, Believe it or not, things fell into place with just those two word from your letter. Excellent! -T

Re: for and ^ question

2020-12-31 Thread ToddAndMargo via perl6-users
On 12/30/20 5:39 PM, ToddAndMargo via perl6-users wrote: Hi All, In the following for loop:     for ^$nCount -> $i { What is the ^ doing? Confused again, -T With wonderful explanations for many others, my notes: ^ note: ^3 means the integer "just before" 3 (zero is presume to be the st

Re: for and ^ question

2020-12-31 Thread ToddAndMargo via perl6-users
On 12/31/20 1:56 PM, Brad Gilbert wrote: It does not look like an array from 0 to ($nCount - 1). It only iterates like that. It is a Range object from 0 to $nCount excluding $nCount.     ^9 === Range.new( 0, 9, :excludes-max ) # True     0 ~~ ^9 # True     1 ~~ ^9 # True     0.5 ~~ ^9 # Tr

Re: for and ^ question

2020-12-31 Thread ToddAndMargo via perl6-users
On 12/31/20 7:44 AM, William Michels via perl6-users wrote: There's an open Github issue on the interaction between Seqs and carets: https://github.com/rakudo/rakudo/issues/3881 Scroll down to the section entitled, "EDIT 08/29/2020 -- TL;DR Version" for the crux of the issue. > 8 ... ^16 #

Re: for and ^ question

2020-12-31 Thread Brad Gilbert
It does not look like an array from 0 to ($nCount - 1). It only iterates like that. It is a Range object from 0 to $nCount excluding $nCount. ^9 === Range.new( 0, 9, :excludes-max ) # True 0 ~~ ^9 # True 1 ~~ ^9 # True 0.5 ~~ ^9 # True 8 ~~ ^9 # True 8.9 ~~ ^9 # True

Re: for and ^ question

2020-12-31 Thread Andy Bach
PM To: ToddAndMargo Cc: perl6-users Subject: Re: for and ^ question CAUTION - EXTERNAL: Look up ..^ which is the long form of ^ when used in ^8 sort of thing https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT "Constructs a Range<https://docs.raku.org/type/Range> from the arguments, exclud

Re: for and ^ question

2020-12-31 Thread William Michels via perl6-users
On Wed, Dec 30, 2020 at 7:20 PM ToddAndMargo via perl6-users wrote: > > On 12/30/20 7:06 PM, yary wrote: > > Look up ..^ which is the long form of ^ when used in ^8 sort of thing > > > > https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT > > > >

Re: for and ^ question

2020-12-30 Thread ToddAndMargo via perl6-users
On 12/30/20 7:06 PM, yary wrote: Look up ..^ which is the long form of ^ when used in ^8 sort of thing https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT "Constructs a Range  from the arguments, excluding

Re: for and ^ question

2020-12-30 Thread yary
Look up ..^ which is the long form of ^ when used in ^8 sort of thing https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT "Constructs a Range from the arguments, excluding the end point." try out these 3 .. 7 3 ..^ 7 3 ^.. 7 3 ^..^ 7 and also see https://docs.r

Re: for and ^ question

2020-12-30 Thread ToddAndMargo via perl6-users
On 12/30/20 6:04 PM, Curt Tilmes wrote: On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users wrote: In the following for loop: for ^$nCount -> $i { What is the ^ doing? https://docs.raku.org/type/Range About the third paragraph from the top: The caret is also a prefix opera

Re: for and ^ question

2020-12-30 Thread ToddAndMargo via perl6-users
On 12/30/20 5:39 PM, ToddAndMargo via perl6-users wrote: Hi All, In the following for loop:     for ^$nCount -> $i { What is the ^ doing? Confused again, -T Used in context, the ^ makes the integer $nCount look like an array of 0 to ($nCount - 1). Am I missing something? my $x=4; for ^$x

Re: for and ^ question

2020-12-30 Thread Curt Tilmes
On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users wrote: > In the following for loop: > > for ^$nCount -> $i { > > What is the ^ doing? https://docs.raku.org/type/Range About the third paragraph from the top: The caret is also a prefix operator for constructing numeric ranges s