for and ^ question

Hi All,

In the following for loop:

     for ^$nCount -> $i {

What is the ^ doing?

Confused again,
-T
0
perl6
12/31/2020 1:39:56 AM
perl.perl6.users 1547 articles. 0 followers. Follow

23 Replies
26 Views

Similar Articles

[PageSpeed] 1

On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users
<perl6-users@perl.org> 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
starting from zero:
    my $x = 10;
    say ^$x;     # same as 0 ..^ $x.Numeric
0
curt
12/31/2020 2:04:03 AM
On 12/30/20 5:39 PM, ToddAndMargo via perl6-users wrote:
> Hi All,
>=20
> In the following for loop:
>=20
>  =C2=A0=C2=A0=C2=A0 for ^$nCount -> $i {
>=20
> What is the ^ doing?
>=20
> 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=3D4;
for ^$x -> $i { print "i =3D $i\n"; }

i =3D 0
i =3D 1
i =3D 2
i =3D 3

0
perl6
12/31/2020 2:09:23 AM
On 12/30/20 6:04 PM, Curt Tilmes wrote:
> On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users
> <perl6-users@perl.org> 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
> starting from zero:
>      my $x = 10;
>      say ^$x;     # same as 0 ..^ $x.Numeric
> 

Thank you!

In a for look, it looks like 0 through 9.  Is that
the for loops doing?

0
perl6
12/31/2020 2:42:21 AM
--00000000000052cac305b7b9e9ac
Content-Type: text/plain; charset="UTF-8"

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,
excluding the end point."

try out these
3 .. 7
3 ..^ 7
3 ^.. 7
3 ^..^ 7

and also see
https://docs.raku.org/routine/...html
https://docs.raku.org/routine/$CIRCUMFLEX_ACCENT...html
https://docs.raku.org/routine/$CIRCUMFLEX_ACCENT..$CIRCUMFLEX_ACCENT





-y


On Wed, Dec 30, 2020 at 9:42 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 12/30/20 6:04 PM, Curt Tilmes wrote:
> > On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users
> > <perl6-users@perl.org> 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
> > starting from zero:
> >      my $x = 10;
> >      say ^$x;     # same as 0 ..^ $x.Numeric
> >
>
> Thank you!
>
> In a for look, it looks like 0 through 9.  Is that
> the for loops doing?
>
>

--00000000000052cac305b7b9e9ac
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div di=
r=3D"ltr"><div dir=3D"ltr">Look up ..^ which is the long form of ^ when use=
d in ^8 sort of thing<div><br></div><div><a href=3D"https://docs.raku.org/r=
outine/..$CIRCUMFLEX_ACCENT">https://docs.raku.org/routine/..$CIRCUMFLEX_AC=
CENT</a></div><div><br></div><div>&quot;<span style=3D"color:rgb(0,0,0);fon=
t-family:sans-serif;font-size:14px">Constructs a=C2=A0</span><a href=3D"htt=
ps://docs.raku.org/type/Range" style=3D"text-decoration:none;font-family:sa=
ns-serif;font-size:14px">Range</a><span style=3D"color:rgb(0,0,0);font-fami=
ly:sans-serif;font-size:14px">=C2=A0from the arguments, excluding the end p=
oint.&quot;</span></div><div><font color=3D"#000000" face=3D"sans-serif"><s=
pan style=3D"font-size:14px"><br></span></font></div><div><font color=3D"#0=
00000" face=3D"sans-serif"><span style=3D"font-size:14px">try out these=C2=
=A0</span></font></div><div><font color=3D"#000000" face=3D"sans-serif"><sp=
an style=3D"font-size:14px">3 .. 7</span></font></div><div><font color=3D"#=
000000" face=3D"sans-serif"><span style=3D"font-size:14px">3 ..^ 7</span></=
font></div><div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"=
font-size:14px">3 ^.. 7</span></font></div><div><font color=3D"#000000" fac=
e=3D"sans-serif"><span style=3D"font-size:14px">3 ^..^ 7</span></font></div=
><div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:=
14px"><br></span></font></div><div><font color=3D"#000000" face=3D"sans-ser=
if"><span style=3D"font-size:14px">and also see</span></font></div><div><a =
href=3D"https://docs.raku.org/routine/...html">https://docs.raku.org/routin=
e/...html</a><font color=3D"#000000" face=3D"sans-serif"><span style=3D"fon=
t-size:14px"><br></span></font></div><div><a href=3D"https://docs.raku.org/=
routine/$CIRCUMFLEX_ACCENT...html">https://docs.raku.org/routine/$CIRCUMFLE=
X_ACCENT...html</a><br></div><div><a href=3D"https://docs.raku.org/routine/=
$CIRCUMFLEX_ACCENT..$CIRCUMFLEX_ACCENT">https://docs.raku.org/routine/$CIRC=
UMFLEX_ACCENT..$CIRCUMFLEX_ACCENT</a><br></div><div><br></div><div><br></di=
v><div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size=
:14px"><br></span></font></div><div><font color=3D"#000000" face=3D"sans-se=
rif"><span style=3D"font-size:14px"><br></span></font></div><div><font colo=
r=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:14px"><br clear=
=3D"all"></span></font><div><div dir=3D"ltr" class=3D"gmail_signature">-y<b=
r></div></div><br></div></div></div></div></div></div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 30, 2020=
 at 9:42 PM ToddAndMargo via perl6-users &lt;<a href=3D"mailto:perl6-users@=
perl.org">perl6-users@perl.org</a>&gt; wrote:<br></div><blockquote class=3D=
"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;borde=
r-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On =
12/30/20 6:04 PM, Curt Tilmes wrote:<br>
&gt; On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users<br>
&gt; &lt;<a href=3D"mailto:perl6-users@perl.org" target=3D"_blank">perl6-us=
ers@perl.org</a>&gt; wrote:<br>
&gt;&gt; In the following for loop:<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0for ^$nCount -&gt; $i {<br>
&gt;&gt;<br>
&gt;&gt; What is the ^ doing?<br>
&gt; <br>
&gt; <a href=3D"https://docs.raku.org/type/Range" rel=3D"noreferrer" target=
=3D"_blank">https://docs.raku.org/type/Range</a>=C2=A0 =C2=A0About the thir=
d paragraph from the top:<br>
&gt; <br>
&gt; The caret is also a prefix operator for constructing numeric ranges<br=
>
&gt; starting from zero:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 my $x =3D 10;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 say ^$x;=C2=A0 =C2=A0 =C2=A0# same as 0 ..^ $x.Num=
eric<br>
&gt; <br>
<br>
Thank you!<br>
<br>
In a for look, it looks like 0 through 9.=C2=A0 Is that<br>
the for loops doing?<br>
<br>
</blockquote></div>

--00000000000052cac305b7b9e9ac--
0
not
12/31/2020 3:06:24 AM
On 12/30/20 7:06 PM, yary wrote:
> Look up ..^ which is the long form of ^ when used in ^8 sort of thing
>=20
> https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT=20
> <https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT>
>=20
> "Constructs a Range <https://docs.raku.org/type/Range>=C2=A0from the=20
> arguments, excluding the end point."
>=20
> try out these
> 3 .. 7
> 3 ..^ 7
> 3 ^.. 7
> 3 ^..^ 7

Hi Yary,

    You have got to love Raku!   Thank you!

-T

 > $x=3D4; for 3..7 -> $i { print "i =3D $i\n"; }
i =3D 3
i =3D 4
i =3D 5
i =3D 6
i =3D 7

 > $x=3D4; for 3..^7 -> $i { print "i =3D $i\n"; }
i =3D 3
i =3D 4
i =3D 5
i =3D 6

 > $x=3D4; for 3^..7 -> $i { print "i =3D $i\n"; }
i =3D 4
i =3D 5
i =3D 6
i =3D 7

 > $x=3D4; for 3^..^7 -> $i { print "i =3D $i\n"; }
i =3D 4
i =3D 5
i =3D 6

0
perl6
12/31/2020 3:19:56 AM
On Wed, Dec 30, 2020 at 7:20 PM ToddAndMargo via perl6-users
<perl6-users@perl.org> 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
> > <https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT>
> >
> > "Constructs a Range <https://docs.raku.org/type/Range> from the
> > arguments, excluding the end point."
> >
> > try out these
> > 3 .. 7
> > 3 ..^ 7
> > 3 ^.. 7
> > 3 ^..^ 7
>
> Hi Yary,
>
>     You have got to love Raku!   Thank you!
>
> -T
>
>  > $x=4; for 3..7 -> $i { print "i = $i\n"; }
> i = 3
> i = 4
> i = 5
> i = 6
> i = 7
>
>  > $x=4; for 3..^7 -> $i { print "i = $i\n"; }
> i = 3
> i = 4
> i = 5
> i = 6
>
>  > $x=4; for 3^..7 -> $i { print "i = $i\n"; }
> i = 4
> i = 5
> i = 6
> i = 7
>
>  > $x=4; for 3^..^7 -> $i { print "i = $i\n"; }
> i = 4
> i = 5
> i = 6
>

Hi Todd (and Yary, and Curt),

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.

And please feel free to comment on Github!

Best, Bill.
0
perl6
12/31/2020 3:44:06 PM
--_000_DM8PR09MB6613AE59E7381F37B7CB41AEC0D60DM8PR09MB6613namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

> try out these
3 .. 7
3 ..^ 7
3 ^.. 7
3 ^..^ 7

Is the last one called the kitten or the bat operator? ;->

Happy New Year to all those for whom the year ends tonight. For the rest Ha=
ppy Tomorrow!
________________________________
From: yary <not.com@gmail.com>
Sent: Wednesday, December 30, 2020 9:06 PM
To: ToddAndMargo <ToddAndMargo@zoho.com>
Cc: perl6-users <perl6-users@perl.org>
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, e=
xcluding the end point."

try out these
3 .. 7
3 ..^ 7
3 ^.. 7
3 ^..^ 7

and also see
https://docs.raku.org/routine/...html
https://docs.raku.org/routine/$CIRCUMFLEX_ACCENT...html
https://docs.raku.org/routine/$CIRCUMFLEX_ACCENT..$CIRCUMFLEX_ACCENT





-y


On Wed, Dec 30, 2020 at 9:42 PM ToddAndMargo via perl6-users <perl6-users@p=
erl.org<mailto:perl6-users@perl.org>> wrote:
On 12/30/20 6:04 PM, Curt Tilmes wrote:
> On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users
> <perl6-users@perl.org<mailto:perl6-users@perl.org>> 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
> starting from zero:
>      my $x =3D 10;
>      say ^$x;     # same as 0 ..^ $x.Numeric
>

Thank you!

In a for look, it looks like 0 through 9.  Is that
the for loops doing?

CAUTION - EXTERNAL EMAIL: This email originated outside the Judiciary. Exer=
cise caution when opening attachments or clicking on links.


--_000_DM8PR09MB6613AE59E7381F37B7CB41AEC0D60DM8PR09MB6613namp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: &quot;Times New Roman&quot;, Times, serif; font-=
size: 12pt; color: rgb(0, 0, 0);">
&gt;&nbsp;<span style=3D"font-size: 14px;">try out these&nbsp;</span>
<div style=3D"margin:0px;font-size:15px;font-family:&quot;Segoe UI&quot;, &=
quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-syste=
m, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif;color=
:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
<font color=3D"black" face=3D"sans-serif"><span style=3D"margin:0px;font-si=
ze:14px">3 .. 7</span></font></div>
<div style=3D"margin:0px;font-size:15px;font-family:&quot;Segoe UI&quot;, &=
quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-syste=
m, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif;color=
:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
<font color=3D"black" face=3D"sans-serif"><span style=3D"margin:0px;font-si=
ze:14px">3 ..^ 7</span></font></div>
<div style=3D"margin:0px;font-size:15px;font-family:&quot;Segoe UI&quot;, &=
quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-syste=
m, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif;color=
:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
<font color=3D"black" face=3D"sans-serif"><span style=3D"margin:0px;font-si=
ze:14px">3 ^.. 7</span></font></div>
<div style=3D"margin:0px;font-size:15px;font-family:&quot;Segoe UI&quot;, &=
quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-syste=
m, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif;color=
:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
<font color=3D"black" face=3D"sans-serif"><span style=3D"margin:0px;font-si=
ze:14px">3 ^..^ 7</span></font></div>
<div style=3D"margin:0px;font-size:15px;font-family:&quot;Segoe UI&quot;, &=
quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-syste=
m, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif;color=
:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
<font color=3D"black" face=3D"sans-serif"><span style=3D"margin:0px;font-si=
ze:14px"><br>
</span></font></div>
<div style=3D"margin:0px;font-size:15px;font-family:&quot;Segoe UI&quot;, &=
quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-syste=
m, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif;color=
:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
<font color=3D"black" face=3D"sans-serif"><span style=3D"margin:0px;font-si=
ze:14px">Is the last one called the kitten or the bat operator? ;-&gt;</spa=
n></font></div>
<div style=3D"margin:0px;font-size:15px;font-family:&quot;Segoe UI&quot;, &=
quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-syste=
m, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif;color=
:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
<font color=3D"black" face=3D"sans-serif"><span style=3D"margin:0px;font-si=
ze:14px"><br>
</span></font></div>
<div style=3D"margin:0px;font-size:15px;font-family:&quot;Segoe UI&quot;, &=
quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-syste=
m, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif;color=
:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
<font color=3D"black" face=3D"sans-serif"><span style=3D"margin:0px;font-si=
ze:14px">Happy New Year to all those for whom the year ends tonight. For th=
e rest Happy Tomorrow!</span></font></div>
</div>
<div id=3D"appendonsend"></div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> yary &lt;not.com@gmai=
l.com&gt;<br>
<b>Sent:</b> Wednesday, December 30, 2020 9:06 PM<br>
<b>To:</b> ToddAndMargo &lt;ToddAndMargo@zoho.com&gt;<br>
<b>Cc:</b> perl6-users &lt;perl6-users@perl.org&gt;<br>
<b>Subject:</b> Re: for and ^ question</font>
<div>&nbsp;</div>
</div>
<div><style type=3D"text/css">
<!--
..x_tg
	{border-collapse:collapse;
	border-spacing:0}
..x_tg td
	{border-color:black;
	border-style:none;
	border-width:1px;
	font-family:Arial,sans-serif;
	font-size:14px;
	overflow:hidden;
	padding:5px 5px;
	word-break:normal}
..x_tg th
	{border-color:black;
	border-style:none;
	border-width:1px;
	font-family:Arial,sans-serif;
	font-size:14px;
	font-weight:normal;
	overflow:hidden;
	padding:2px 2px;
	word-break:normal}
..x_tg .x_tg-94ls
	{background-color:#cb0000;
	border-color:inherit;
	text-align:left;
	vertical-align:top}
..x_tg .x_tg-pzl3
	{background-color:#FFFF00;
	border-color:inherit;
	text-align:left;
	vertical-align:top}
-->
</style>
<table class=3D"x_tg">
<thead>
<tr>
<th class=3D"x_tg-pzl3"><b>CAUTION - EXTERNAL: <br>
</b></th>
</tr>
</thead>
</table>
<br>
<div>
<div dir=3D"ltr">
<div dir=3D"ltr">
<div dir=3D"ltr">
<div dir=3D"ltr">
<div dir=3D"ltr">
<div dir=3D"ltr">Look up ..^ which is the long form of ^ when used in ^8 so=
rt of thing
<div><br>
</div>
<div><a href=3D"https://docs.raku.org/routine/..$CIRCUMFLEX_ACCENT">https:/=
/docs.raku.org/routine/..$CIRCUMFLEX_ACCENT</a></div>
<div><br>
</div>
<div>&quot;<span style=3D"color:rgb(0,0,0); font-family:sans-serif; font-si=
ze:14px">Constructs a&nbsp;</span><a href=3D"https://docs.raku.org/type/Ran=
ge" style=3D"text-decoration:none; font-family:sans-serif; font-size:14px">=
Range</a><span style=3D"color:rgb(0,0,0); font-family:sans-serif; font-size=
:14px">&nbsp;from
 the arguments, excluding the end point.&quot;</span></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px"><br>
</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px">try out these&nbsp;</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px">3 .. 7</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px">3 ..^ 7</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px">3 ^.. 7</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px">3 ^..^ 7</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px"><br>
</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px">and also see</span></font></div>
<div><a href=3D"https://docs.raku.org/routine/...html">https://docs.raku.or=
g/routine/...html</a><font color=3D"#000000" face=3D"sans-serif"><span styl=
e=3D"font-size:14px"><br>
</span></font></div>
<div><a href=3D"https://docs.raku.org/routine/$CIRCUMFLEX_ACCENT...html">ht=
tps://docs.raku.org/routine/$CIRCUMFLEX_ACCENT...html</a><br>
</div>
<div><a href=3D"https://docs.raku.org/routine/$CIRCUMFLEX_ACCENT..$CIRCUMFL=
EX_ACCENT">https://docs.raku.org/routine/$CIRCUMFLEX_ACCENT..$CIRCUMFLEX_AC=
CENT</a><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px"><br>
</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px"><br>
</span></font></div>
<div><font color=3D"#000000" face=3D"sans-serif"><span style=3D"font-size:1=
4px"><br clear=3D"all">
</span></font>
<div>
<div dir=3D"ltr" class=3D"x_gmail_signature">-y<br>
</div>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class=3D"x_gmail_quote">
<div dir=3D"ltr" class=3D"x_gmail_attr">On Wed, Dec 30, 2020 at 9:42 PM Tod=
dAndMargo via perl6-users &lt;<a href=3D"mailto:perl6-users@perl.org">perl6=
-users@perl.org</a>&gt; wrote:<br>
</div>
<blockquote class=3D"x_gmail_quote" style=3D"margin:0px 0px 0px 0.8ex; bord=
er-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,2=
04); padding-left:1ex">
On 12/30/20 6:04 PM, Curt Tilmes wrote:<br>
&gt; On Wed, Dec 30, 2020 at 8:40 PM ToddAndMargo via perl6-users<br>
&gt; &lt;<a href=3D"mailto:perl6-users@perl.org" target=3D"_blank">perl6-us=
ers@perl.org</a>&gt; wrote:<br>
&gt;&gt; In the following for loop:<br>
&gt;&gt;<br>
&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;for ^$nCount -&gt; $i {<br>
&gt;&gt;<br>
&gt;&gt; What is the ^ doing?<br>
&gt; <br>
&gt; <a href=3D"https://docs.raku.org/type/Range" rel=3D"noreferrer" target=
=3D"_blank">https://docs.raku.org/type/Range</a>&nbsp; &nbsp;About the thir=
d paragraph from the top:<br>
&gt; <br>
&gt; The caret is also a prefix operator for constructing numeric ranges<br=
>
&gt; starting from zero:<br>
&gt;&nbsp; &nbsp; &nbsp; my $x =3D 10;<br>
&gt;&nbsp; &nbsp; &nbsp; say ^$x;&nbsp; &nbsp; &nbsp;# same as 0 ..^ $x.Num=
eric<br>
&gt; <br>
<br>
Thank you!<br>
<br>
In a for look, it looks like 0 through 9.&nbsp; Is that<br>
the for loops doing?<br>
<br>
</blockquote>
</div>
</div>
<style type=3D"text/css">
<!--
..x_tg
	{border-collapse:collapse;
	border-spacing:0}
..x_tg td
	{border-color:black;
	border-style:none;
	border-width:1px;
	font-family:Arial,sans-serif;
	font-size:14px;
	overflow:hidden;
	padding:5px 5px;
	word-break:normal}
..x_tg th
	{border-color:black;
	border-style:none;
	border-width:1px;
	font-family:Arial,sans-serif;
	font-size:14px;
	font-weight:normal;
	overflow:hidden;
	padding:2px 2px;
	word-break:normal}
..x_tg .x_tg-94ls
	{background-color:#cb0000;
	border-color:inherit;
	text-align:left;
	vertical-align:top}
..x_tg .x_tg-pzl3
	{background-color:#FFFF00;
	border-color:inherit;
	text-align:left;
	vertical-align:top}
-->
</style>
<table class=3D"x_tg">
<thead>
<tr>
<th class=3D"x_tg-pzl3"><b>CAUTION - EXTERNAL EMAIL:</b> This email origina=
ted outside the Judiciary. Exercise caution when opening attachments or cli=
cking on links.
</th>
</tr>
</thead>
</table>
<br>
</div>
</body>
</html>

--_000_DM8PR09MB6613AE59E7381F37B7CB41AEC0D60DM8PR09MB6613namp_--
0
Andy_Bach
12/31/2020 3:52:49 PM
--0000000000008efd5205b7c9b190
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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 =3D=3D=3D Range.new( 0, 9, :excludes-max ) # True
    0 ~~ ^9 # True
    1 ~~ ^9 # True
    0.5 ~~ ^9 # True
    8 ~~ ^9 # True
    8.99999 ~~ ^9 # True

    9 ~~ ^9 # False

In the case of `for ^9 {=E2=80=A6}` it iterates starting at 0, and continui=
ng to
just before 9.

It does that because `for` iterates the Range object.

It does NOT store any values other than the min, max and either excludes.

An array would store the values in the middle. Which would be a waste of
memory.
Which is why it does not do that.

On Wed, Dec 30, 2020 at 8:09 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> 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=3D4;
> for ^$x -> $i { print "i =3D $i\n"; }
>
> i =3D 0
> i =3D 1
> i =3D 2
> i =3D 3
>
>

--0000000000008efd5205b7c9b190
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It does not look like an array from=C2=A00 to ($nCount - 1=
). It only iterates like that.<div><br></div><div>It is a Range object from=
 0 to $nCount excluding $nCount.</div><div><br></div><div>=C2=A0 =C2=A0 ^9 =
=3D=3D=3D Range.new( 0, 9, :excludes-max ) # True</div><div>=C2=A0 =C2=A0 0=
 ~~ ^9 # True</div><div>=C2=A0 =C2=A0 1 ~~ ^9 # True</div><div>=C2=A0 =C2=
=A0 0.5 ~~ ^9 # True</div><div>=C2=A0 =C2=A0 8 ~~ ^9 # True</div><div>=C2=
=A0 =C2=A0 8.99999 ~~ ^9 # True</div><div><br></div><div>=C2=A0 =C2=A0 9 ~~=
 ^9 # False</div><div><br></div><div>In the case of `for ^9 {=E2=80=A6}` it=
 iterates=C2=A0starting at 0, and continuing to just before 9.</div><div><b=
r></div><div>It does that because `for` iterates the Range object.</div><di=
v><br></div><div>It does NOT store any values other than the min, max and e=
ither excludes.</div><div><br></div><div>An array would store the values in=
 the middle. Which would be a waste of memory.</div><div>Which is why it do=
es not do that.</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Wed, Dec 30, 2020 at 8:09 PM ToddAndMargo via perl6=
-users &lt;<a href=3D"mailto:perl6-users@perl.org">perl6-users@perl.org</a>=
&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 1=
2/30/20 5:39 PM, ToddAndMargo via perl6-users wrote:<br>
&gt; Hi All,<br>
&gt; <br>
&gt; In the following for loop:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0=C2=A0=C2=A0 for ^$nCount -&gt; $i {<br>
&gt; <br>
&gt; What is the ^ doing?<br>
&gt; <br>
&gt; Confused again,<br>
&gt; -T<br>
<br>
Used in context, the ^ makes the integer $nCount look<br>
like an array of 0 to ($nCount - 1).=C2=A0 Am I missing<br>
something?<br>
<br>
my $x=3D4;<br>
for ^$x -&gt; $i { print &quot;i =3D $i\n&quot;; }<br>
<br>
i =3D 0<br>
i =3D 1<br>
i =3D 2<br>
i =3D 3<br>
<br>
</blockquote></div>

--0000000000008efd5205b7c9b190--
0
b2gills
12/31/2020 9:56:07 PM
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   # now I want 8 elements--get 24 instead, WAT? :
(8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)

Yikes!

0
perl6
1/1/2021 3:56:16 AM
On 12/31/20 1:56 PM, Brad Gilbert wrote:
> It does not look like an array from=C2=A00 to ($nCount - 1). It only it=
erates=20
> like that.
>=20
> It is a Range object from 0 to $nCount excluding $nCount.
>=20
>  =C2=A0 =C2=A0 ^9 =3D=3D=3D Range.new( 0, 9, :excludes-max ) # True
>  =C2=A0 =C2=A0 0 ~~ ^9 # True
>  =C2=A0 =C2=A0 1 ~~ ^9 # True
>  =C2=A0 =C2=A0 0.5 ~~ ^9 # True
>  =C2=A0 =C2=A0 8 ~~ ^9 # True
>  =C2=A0 =C2=A0 8.99999 ~~ ^9 # True
>=20
>  =C2=A0 =C2=A0 9 ~~ ^9 # False
>=20
> In the case of `for ^9 {=E2=80=A6}` it iterates=C2=A0starting at 0, and=
 continuing to=20
> just before 9.
>=20
> It does that because `for` iterates the Range object.
>=20
> It does NOT store any values other than the min, max and either exclude=
s.
>=20
> An array would store the values in the middle. Which would be a waste o=
f=20
> memory.
> Which is why it does not do that.
>=20
> On Wed, Dec 30, 2020 at 8:09 PM ToddAndMargo via perl6-users=20
> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
>=20
>     On 12/30/20 5:39 PM, ToddAndMargo via perl6-users wrote:
>      > Hi All,
>      >
>      > In the following for loop:
>      >
>      >=C2=A0 =C2=A0=C2=A0=C2=A0 for ^$nCount -> $i {
>      >
>      > What is the ^ doing?
>      >
>      > Confused again,
>      > -T
>=20
>     Used in context, the ^ makes the integer $nCount look
>     like an array of 0 to ($nCount - 1).=C2=A0 Am I missing
>     something?
>=20
>     my $x=3D4;
>     for ^$x -> $i { print "i =3D $i\n"; }
>=20
>     i =3D 0
>     i =3D 1
>     i =3D 2
>     i =3D 3
>=20


Thank you!

0
perl6
1/1/2021 3:57:41 AM
On 12/30/20 5:39 PM, ToddAndMargo via perl6-users wrote:
> Hi All,
>=20
> In the following for loop:
>=20
>  =C2=A0=C2=A0=C2=A0 for ^$nCount -> $i {
>=20
> What is the ^ doing?
>=20
> 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 =

start point)

          3^ means the integer "just after" 3  (an ending point is requir=
ed)


Looping using an integer (avoids having to use a C loop):

    # loop to "just before" $x starting at 0 by 1
    > my $x=3D3; for ^$x -> $i { print "i =3D $i\n"; }
    i =3D 0
    i =3D 1
    i =3D 2

    # loop from 3 to 5 by 1
    > for 3..5 -> $i { print "i =3D $i\n"; }
    i =3D 3
    i =3D 4
    i =3D 5

    # loop from 3 to "just before" 6 by 1
    > for 3..^6 -> $i { print "i =3D $i\n"; }
    i =3D 3
    i =3D 4
    i =3D 5

    # loop from "just after" 3 to 6 by 1
    > for 3^..6 -> $i { print "i =3D $i\n"; }
    i =3D 4
    i =3D 5
    i =3D 6

    # loop from "just after" 3 to "just before" 7 by 1
    > for 3^..^7 -> $i { print "i =3D $i\n"; }
    i =3D 4
    i =3D 5
    i =3D 6


0
perl6
1/1/2021 5:32:06 AM
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
0
perl6
1/1/2021 5:33:06 AM
--000000000000a4419b05b7d0ac12
Content-Type: text/plain; charset="UTF-8"

>
> ^ 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" is just a short-cut) says
anything about integers. It is the range of numbers (real numbers if you
like) ranging from 0 to 3, but excluding 3. In standard mathematical
notation that would be "[0,3)". If you iterate over the range then you
start with the beginning of the range and keep adding one until you reach
the end (in this case ignoring the final value if it is equal to the
end-point).

If the range were 0.5 .. 3 then the iterated values would be 0.5, 1.5 and
2.5.

On Fri, 1 Jan 2021 at 16:32, ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> 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
> start point)
>
>           3^ means the integer "just after" 3  (an ending point is
> required)
>
>
> Looping using an integer (avoids having to use a C loop):
>
>     # loop to "just before" $x starting at 0 by 1
>     > my $x=3; for ^$x -> $i { print "i = $i\n"; }
>     i = 0
>     i = 1
>     i = 2
>
>     # loop from 3 to 5 by 1
>     > for 3..5 -> $i { print "i = $i\n"; }
>     i = 3
>     i = 4
>     i = 5
>
>     # loop from 3 to "just before" 6 by 1
>     > for 3..^6 -> $i { print "i = $i\n"; }
>     i = 3
>     i = 4
>     i = 5
>
>     # loop from "just after" 3 to 6 by 1
>     > for 3^..6 -> $i { print "i = $i\n"; }
>     i = 4
>     i = 5
>     i = 6
>
>     # loop from "just after" 3 to "just before" 7 by 1
>     > for 3^..^7 -> $i { print "i = $i\n"; }
>     i = 4
>     i = 5
>     i = 6
>
>
>

--000000000000a4419b05b7d0ac12
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">^ note: =
^3 means the integer &quot;just before&quot; 3=C2=A0 (zero is presume to be=
 the<br>start point)<br><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3^ means the=
 integer &quot;just after&quot; 3=C2=A0 (an ending point is required)<br></=
blockquote><div><br></div><div>No, it does not. Go back and read what Brad =
wrote; he was quite explicit.</div><div><br></div><div>Nothing about the ra=
nge 0 ..^ 3 (for which &quot;^3&quot; is just a short-cut) says anything ab=
out integers. It is the range of numbers (real numbers if you like) ranging=
 from 0 to 3, but excluding 3. In standard mathematical notation that would=
 be &quot;[0,3)&quot;. If you iterate over the range then you start with th=
e beginning of the range and keep adding one until you reach the end (in th=
is case ignoring the final value if it is equal to the end-point).</div><di=
v><br></div><div>If the range were 0.5 .. 3 then the iterated values would =
be 0.5, 1.5 and 2.5.</div></div><br><div class=3D"gmail_quote"><div dir=3D"=
ltr" class=3D"gmail_attr">On Fri, 1 Jan 2021 at 16:32, ToddAndMargo via per=
l6-users &lt;<a href=3D"mailto:perl6-users@perl.org">perl6-users@perl.org</=
a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On=
 12/30/20 5:39 PM, ToddAndMargo via perl6-users wrote:<br>
&gt; Hi All,<br>
&gt; <br>
&gt; In the following for loop:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0=C2=A0=C2=A0 for ^$nCount -&gt; $i {<br>
&gt; <br>
&gt; What is the ^ doing?<br>
&gt; <br>
&gt; Confused again,<br>
&gt; -T<br>
<br>
With wonderful explanations for many others, my notes:<br>
<br>
<br>
^ note: ^3 means the integer &quot;just before&quot; 3=C2=A0 (zero is presu=
me to be the <br>
start point)<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3^ means the integer &quot;just after&qu=
ot; 3=C2=A0 (an ending point is required)<br>
<br>
<br>
Looping using an integer (avoids having to use a C loop):<br>
<br>
=C2=A0 =C2=A0 # loop to &quot;just before&quot; $x starting at 0 by 1<br>
=C2=A0 =C2=A0 &gt; my $x=3D3; for ^$x -&gt; $i { print &quot;i =3D $i\n&quo=
t;; }<br>
=C2=A0 =C2=A0 i =3D 0<br>
=C2=A0 =C2=A0 i =3D 1<br>
=C2=A0 =C2=A0 i =3D 2<br>
<br>
=C2=A0 =C2=A0 # loop from 3 to 5 by 1<br>
=C2=A0 =C2=A0 &gt; for 3..5 -&gt; $i { print &quot;i =3D $i\n&quot;; }<br>
=C2=A0 =C2=A0 i =3D 3<br>
=C2=A0 =C2=A0 i =3D 4<br>
=C2=A0 =C2=A0 i =3D 5<br>
<br>
=C2=A0 =C2=A0 # loop from 3 to &quot;just before&quot; 6 by 1<br>
=C2=A0 =C2=A0 &gt; for 3..^6 -&gt; $i { print &quot;i =3D $i\n&quot;; }<br>
=C2=A0 =C2=A0 i =3D 3<br>
=C2=A0 =C2=A0 i =3D 4<br>
=C2=A0 =C2=A0 i =3D 5<br>
<br>
=C2=A0 =C2=A0 # loop from &quot;just after&quot; 3 to 6 by 1<br>
=C2=A0 =C2=A0 &gt; for 3^..6 -&gt; $i { print &quot;i =3D $i\n&quot;; }<br>
=C2=A0 =C2=A0 i =3D 4<br>
=C2=A0 =C2=A0 i =3D 5<br>
=C2=A0 =C2=A0 i =3D 6<br>
<br>
=C2=A0 =C2=A0 # loop from &quot;just after&quot; 3 to &quot;just before&quo=
t; 7 by 1<br>
=C2=A0 =C2=A0 &gt; for 3^..^7 -&gt; $i { print &quot;i =3D $i\n&quot;; }<br=
>
=C2=A0 =C2=A0 i =3D 4<br>
=C2=A0 =C2=A0 i =3D 5<br>
=C2=A0 =C2=A0 i =3D 6<br>
<br>
<br>
</blockquote></div>

--000000000000a4419b05b7d0ac12--
0
kevin
1/1/2021 6:15:50 AM
>>     ^ 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.
> 
> Nothing about the range 0 ..^ 3 (for which "^3" is just a short-cut) 
> says anything about integers. It is the range of numbers (real numbers 
> if you like) ranging from 0 to 3, but excluding 3. In standard 
> mathematical notation that would be "[0,3)". If you iterate over the 
> range then you start with the beginning of the range and keep adding one 
> until you reach the end (in this case ignoring the final value if it is 
> equal to the end-point).
> 
> If the range were 0.5 .. 3 then the iterated values would be 0.5, 1.5 
> and 2.5.


Hi Kevin,

I am glad to be wrong!

I am going to have to play with REPL a bunch.
I will write back my new notes.

Thank you!

-T
0
perl6
1/1/2021 7:49:58 AM
>>     ^ 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.
> 
> Nothing about the range 0 ..^ 3 (for which "^3" is just a short-cut) 
> says anything about integers. It is the range of numbers (real numbers 
> if you like) ranging from 0 to 3, but excluding 3. In standard 
> mathematical notation that would be "[0,3)". If you iterate over the 
> range then you start with the beginning of the range and keep adding one 
> until you reach the end (in this case ignoring the final value if it is 
> equal to the end-point).
> 
> If the range were 0.5 .. 3 then the iterated values would be 0.5, 1.5 
> and 2.5.


Hi Kevin,

My notes were for "for" loops.

    > for ^2 {print "$_\n";}
    0
    1


I am not able to reproduce your comments:

    > for ^2.1..2.5 {print "$_\n";}
    Range objects are not valid endpoints for Ranges
      in block <unit> at <unknown file> line 1

    > for ^2.1 .. 2.5 {print "$_\n";}
    Range objects are not valid endpoints for Ranges
      in block <unit> at <unknown file> line 1

Would you mind throwing me an REPL example?

Many thanks,
-T


0
perl6
1/1/2021 7:59:23 AM
--0000000000004e8da505b7d2ae5f
Content-Type: text/plain; charset="UTF-8"

 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. Hence the error message is
quite correct.

There are four infix operators which create ranges: "..", "^..", "..^" and
"^..^"
and the prefix operator "^:"; you're trying to mix two of them.

All of those take numbers as their arguments, not ranges.

Try something like

..say for 2.1 .. 2.5

You can try
..say for 2.1 ^.. 2.5
and then explain the output.

On Fri, 1 Jan 2021 at 18:59, ToddAndMargo via perl6-users <
perl6-users@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 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.
> >
> > Nothing about the range 0 ..^ 3 (for which "^3" is just a short-cut)
> > says anything about integers. It is the range of numbers (real numbers
> > if you like) ranging from 0 to 3, but excluding 3. In standard
> > mathematical notation that would be "[0,3)". If you iterate over the
> > range then you start with the beginning of the range and keep adding one
> > until you reach the end (in this case ignoring the final value if it is
> > equal to the end-point).
> >
> > If the range were 0.5 .. 3 then the iterated values would be 0.5, 1.5
> > and 2.5.
>
>
> Hi Kevin,
>
> My notes were for "for" loops.
>
>     > for ^2 {print "$_\n";}
>     0
>     1
>
>
> I am not able to reproduce your comments:
>
>     > for ^2.1..2.5 {print "$_\n";}
>     Range objects are not valid endpoints for Ranges
>       in block <unit> at <unknown file> line 1
>
>     > for ^2.1 .. 2.5 {print "$_\n";}
>     Range objects are not valid endpoints for Ranges
>       in block <unit> at <unknown file> line 1
>
> Would you mind throwing me an REPL example?
>
> Many thanks,
> -T
>
>
>

--0000000000004e8da505b7d2ae5f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">=C2=A0We have established that ^2.1 is a range, meaning al=
l the real numbers from 0 to 2.1, not including the 2.1.<div><br></div><div=
>What do you expect ^2.1 .. 2.5 to mean, That&#39;s a range (the &quot;..&q=
uot;) from &quot;^2.1&quot;, another range to the number 2.5. You can&#39;t=
 have a range starting with=C2=A0a range, A range is between two numbers. H=
ence the error message is quite correct.</div><div><br></div><div>There are=
 four infix operators which create ranges: &quot;..&quot;, &quot;^..&quot;,=
 &quot;..^&quot; and &quot;^..^&quot;</div><div>and the prefix operator &qu=
ot;^:&quot;; you&#39;re trying to mix two of them.</div><div><br></div><div=
>All of those take numbers as their arguments, not ranges.</div><div><br></=
div><div>Try something like</div><div><br></div><div>.say for 2.1 .. 2.5</d=
iv><div><br></div><div>You can try</div><div>.say for 2.1 ^.. 2.5</div><div=
>and then explain the output.</div></div><br><div class=3D"gmail_quote"><di=
v dir=3D"ltr" class=3D"gmail_attr">On Fri, 1 Jan 2021 at 18:59, ToddAndMarg=
o via perl6-users &lt;<a href=3D"mailto:perl6-users@perl.org">perl6-users@p=
erl.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"=
margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef=
t:1ex">&gt;&gt;=C2=A0 =C2=A0 =C2=A0^ note: ^3 means the integer &quot;just =
before&quot; 3=C2=A0 (zero is presume to be the<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0start point)<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3^ means th=
e integer &quot;just after&quot; 3=C2=A0 (an ending point is<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0required)<br>
&gt;&gt; <br>
&gt;&gt; <br>
<br>
On 12/31/20 10:15 PM, Kevin Pye wrote:<br>
&gt; No, it does not. Go back and read what Brad wrote; he was quite explic=
it.<br>
&gt; <br>
&gt; Nothing about the range 0 ..^ 3 (for which &quot;^3&quot; is just a sh=
ort-cut) <br>
&gt; says anything about integers. It is the range of numbers (real numbers=
 <br>
&gt; if you like) ranging from 0 to 3, but excluding 3. In standard <br>
&gt; mathematical notation that would be &quot;[0,3)&quot;. If you iterate =
over the <br>
&gt; range then you start with the beginning of the range and keep adding o=
ne <br>
&gt; until you reach the end (in this case ignoring the final value if it i=
s <br>
&gt; equal to the end-point).<br>
&gt; <br>
&gt; If the range were 0.5 .. 3 then the iterated values would be 0.5, 1.5 =
<br>
&gt; and 2.5.<br>
<br>
<br>
Hi Kevin,<br>
<br>
My notes were for &quot;for&quot; loops.<br>
<br>
=C2=A0 =C2=A0 &gt; for ^2 {print &quot;$_\n&quot;;}<br>
=C2=A0 =C2=A0 0<br>
=C2=A0 =C2=A0 1<br>
<br>
<br>
I am not able to reproduce your comments:<br>
<br>
=C2=A0 =C2=A0 &gt; for ^2.1..2.5 {print &quot;$_\n&quot;;}<br>
=C2=A0 =C2=A0 Range objects are not valid endpoints for Ranges<br>
=C2=A0 =C2=A0 =C2=A0 in block &lt;unit&gt; at &lt;unknown file&gt; line 1<b=
r>
<br>
=C2=A0 =C2=A0 &gt; for ^2.1 .. 2.5 {print &quot;$_\n&quot;;}<br>
=C2=A0 =C2=A0 Range objects are not valid endpoints for Ranges<br>
=C2=A0 =C2=A0 =C2=A0 in block &lt;unit&gt; at &lt;unknown file&gt; line 1<b=
r>
<br>
Would you mind throwing me an REPL example?<br>
<br>
Many thanks,<br>
-T<br>
<br>
<br>
</blockquote></div>

--0000000000004e8da505b7d2ae5f--
0
kevin
1/1/2021 8:39:22 AM
>> On Fri, 1 Jan 2021 at 18:59, ToddAndMargo via perl6-users=20
>> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
>>=20
>>      >>     ^ 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)
>>      >>
>>      >>
>>=20
>>     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.
>>      >
>>      > Nothing about the range 0 ..^ 3 (for which "^3" is just a short=
-cut)
>>      > says anything about integers. It is the range of numbers (real
>>     numbers
>>      > if you like) ranging from 0 to 3, but excluding 3. In standard
>>      > mathematical notation that would be "[0,3)". If you iterate ove=
r the
>>      > range then you start with the beginning of the range and keep
>>     adding one
>>      > until you reach the end (in this case ignoring the final value =
if
>>     it is
>>      > equal to the end-point).
>>      >
>>      > If the range were 0.5 .. 3 then the iterated values would be 0.=
5,
>>     1.5
>>      > and 2.5.
>>=20
>>=20
>>     Hi Kevin,
>>=20
>>     My notes were for "for" loops.
>>=20
>>          > for ^2 {print "$_\n";}
>>          0
>>          1
>>=20
>>=20
>>     I am not able to reproduce your comments:
>>=20
>>          > for ^2.1..2.5 {print "$_\n";}
>>          Range objects are not valid endpoints for Ranges
>>            in block <unit> at <unknown file> line 1
>>=20
>>          > for ^2.1 .. 2.5 {print "$_\n";}
>>          Range objects are not valid endpoints for Ranges
>>            in block <unit> at <unknown file> line 1
>>=20
>>     Would you mind throwing me an REPL example?
>>=20
>>     Many thanks,
>>     -T

On 1/1/21 12:39 AM, Kevin Pye wrote:
>  =C2=A0We have established that ^2.1 is a range, meaning all the real n=
umbers=20
> from 0 to 2.1, not including the 2.1.
>=20
> 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 startin=
g=20
> with=C2=A0a range, A range is between two numbers. Hence the error mess=
age is=20
> quite correct.
>=20
> There are four infix operators which create ranges: "..", "^..", "..^" =

> and "^..^"
> and the prefix operator "^:"; you're trying to mix two of them.
>=20
> All of those take numbers as their arguments, not ranges.
>=20
> Try something like
>=20
> .say for 2.1 .. 2.5
>=20
> You can try
> .say for 2.1 ^.. 2.5

 > .say for 2.1 .. 2.5
2.1


 > .say for 2.1 .. ^2.5
Range objects are not valid endpoints for Ranges
   in block <unit> at <unknown file> line 1


> and then explain the output.

Hi Kevin,

I am trying to get it to work in a "for" loop.

I am doing something wrong.

Would you mind sending me the proper syntax
for this from REPL?

-T




0
perl6
1/1/2021 11:13:24 AM
--000000000000890ea105b7d4f852
Content-Type: text/plain; charset="UTF-8"

...^ 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-users@perl.org> wrote:

> >> On Fri, 1 Jan 2021 at 18:59, ToddAndMargo via perl6-users
> >> <perl6-users@perl.org <mailto:perl6-users@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
> >>     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.
> >>      >
> >>      > Nothing about the range 0 ..^ 3 (for which "^3" is just a
> short-cut)
> >>      > says anything about integers. It is the range of numbers (real
> >>     numbers
> >>      > if you like) ranging from 0 to 3, but excluding 3. In standard
> >>      > mathematical notation that would be "[0,3)". If you iterate over
> the
> >>      > range then you start with the beginning of the range and keep
> >>     adding one
> >>      > until you reach the end (in this case ignoring the final value if
> >>     it is
> >>      > equal to the end-point).
> >>      >
> >>      > If the range were 0.5 .. 3 then the iterated values would be 0.5,
> >>     1.5
> >>      > and 2.5.
> >>
> >>
> >>     Hi Kevin,
> >>
> >>     My notes were for "for" loops.
> >>
> >>          > for ^2 {print "$_\n";}
> >>          0
> >>          1
> >>
> >>
> >>     I am not able to reproduce your comments:
> >>
> >>          > for ^2.1..2.5 {print "$_\n";}
> >>          Range objects are not valid endpoints for Ranges
> >>            in block <unit> at <unknown file> line 1
> >>
> >>          > for ^2.1 .. 2.5 {print "$_\n";}
> >>          Range objects are not valid endpoints for Ranges
> >>            in block <unit> at <unknown file> line 1
> >>
> >>     Would you mind throwing me an REPL example?
> >>
> >>     Many thanks,
> >>     -T
>
> On 1/1/21 12:39 AM, Kevin Pye wrote:
> >   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. Hence the error message is
> > quite correct.
> >
> > There are four infix operators which create ranges: "..", "^..", "..^"
> > and "^..^"
> > and the prefix operator "^:"; you're trying to mix two of them.
> >
> > All of those take numbers as their arguments, not ranges.
> >
> > Try something like
> >
> > .say for 2.1 .. 2.5
> >
> > You can try
> > .say for 2.1 ^.. 2.5
>
>  > .say for 2.1 .. 2.5
> 2.1
>
>
>  > .say for 2.1 .. ^2.5
> Range objects are not valid endpoints for Ranges
>    in block <unit> at <unknown file> line 1
>
>
> > and then explain the output.
>
> Hi Kevin,
>
> I am trying to get it to work in a "for" loop.
>
> I am doing something wrong.
>
> Would you mind sending me the proper syntax
> for this from REPL?
>
> -T
>
>
>
>
>

--000000000000890ea105b7d4f852
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">..^ is an operator. You can&#39;t put spaces in the middle=
 of an operator.</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Fri, 1 Jan 2021 at 22:13, ToddAndMargo via perl6-users &=
lt;<a href=3D"mailto:perl6-users@perl.org">perl6-users@perl.org</a>&gt; wro=
te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">&gt;&gt; On =
Fri, 1 Jan 2021 at 18:59, ToddAndMargo via perl6-users <br>
&gt;&gt; &lt;<a href=3D"mailto:perl6-users@perl.org" target=3D"_blank">perl=
6-users@perl.org</a> &lt;mailto:<a href=3D"mailto:perl6-users@perl.org" tar=
get=3D"_blank">perl6-users@perl.org</a>&gt;&gt; wrote:<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;=C2=A0 =C2=A0 =C2=A0^ note: ^3 means t=
he integer &quot;just before&quot; 3=C2=A0 (zero is<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0presume to be the<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;=C2=A0 =C2=A0 =C2=A0start point)<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 3^ means the integer &quot;just after&quot; 3=C2=A0 (an e=
nding<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0point is<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;=C2=A0 =C2=A0 =C2=A0required)<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0On 12/31/20 10:15 PM, Kevin Pye wrote:<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; No, it does not. Go back and read what Br=
ad wrote; he was quite<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0explicit.<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Nothing about the range 0 ..^ 3 (for whic=
h &quot;^3&quot; is just a short-cut)<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; says anything about integers. It is the r=
ange of numbers (real<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0numbers<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; if you like) ranging from 0 to 3, but exc=
luding 3. In standard<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; mathematical notation that would be &quot=
;[0,3)&quot;. If you iterate over the<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; range then you start with the beginning o=
f the range and keep<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0adding one<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; until you reach the end (in this case ign=
oring the final value if<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0it is<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; equal to the end-point).<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; If the range were 0.5 .. 3 then the itera=
ted values would be 0.5,<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A01.5<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 &gt; and 2.5.<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0Hi Kevin,<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0My notes were for &quot;for&quot; loops.<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &gt; for ^2 {print &quot;$_\n&qu=
ot;;}<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0I am not able to reproduce your comments:<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &gt; for ^2.1..2.5 {print &quot;=
$_\n&quot;;}<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Range objects are not valid endp=
oints for Ranges<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 in block &lt;unit&gt; at =
&lt;unknown file&gt; line 1<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &gt; for ^2.1 .. 2.5 {print &quo=
t;$_\n&quot;;}<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Range objects are not valid endp=
oints for Ranges<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 in block &lt;unit&gt; at =
&lt;unknown file&gt; line 1<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0Would you mind throwing me an REPL example?<br>
&gt;&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0Many thanks,<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0-T<br>
<br>
On 1/1/21 12:39 AM, Kevin Pye wrote:<br>
&gt;=C2=A0 =C2=A0We have established that ^2.1 is a range, meaning all the =
real numbers <br>
&gt; from 0 to 2.1, not including the 2.1.<br>
&gt; <br>
&gt; What do you expect ^2.1 .. 2.5 to mean, That&#39;s a range (the &quot;=
...&quot;) from <br>
&gt; &quot;^2.1&quot;, another range to the number 2.5. You can&#39;t have =
a range starting <br>
&gt; with=C2=A0a range, A range is between two numbers. Hence the error mes=
sage is <br>
&gt; quite correct.<br>
&gt; <br>
&gt; There are four infix operators which create ranges: &quot;..&quot;, &q=
uot;^..&quot;, &quot;..^&quot; <br>
&gt; and &quot;^..^&quot;<br>
&gt; and the prefix operator &quot;^:&quot;; you&#39;re trying to mix two o=
f them.<br>
&gt; <br>
&gt; All of those take numbers as their arguments, not ranges.<br>
&gt; <br>
&gt; Try something like<br>
&gt; <br>
&gt; .say for 2.1 .. 2.5<br>
&gt; <br>
&gt; You can try<br>
&gt; .say for 2.1 ^.. 2.5<br>
<br>
=C2=A0&gt; .say for 2.1 .. 2.5<br>
2.1<br>
<br>
<br>
=C2=A0&gt; .say for 2.1 .. ^2.5<br>
Range objects are not valid endpoints for Ranges<br>
=C2=A0 =C2=A0in block &lt;unit&gt; at &lt;unknown file&gt; line 1<br>
<br>
<br>
&gt; and then explain the output.<br>
<br>
Hi Kevin,<br>
<br>
I am trying to get it to work in a &quot;for&quot; loop.<br>
<br>
I am doing something wrong.<br>
<br>
Would you mind sending me the proper syntax<br>
for this from REPL?<br>
<br>
-T<br>
<br>
<br>
<br>
<br>
</blockquote></div>

--000000000000890ea105b7d4f852--
0
kevin
1/1/2021 11:23:22 AM
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 <unit> at <unknown file> line 1

 > for 2.1^..4.5 {print "$_\n";}
3.1
4.1

 > for .1^...5 {print "$_\n";}
1.1
2.1
3.1
4.1


both still increments by 1

What am I doing wrong?
0
perl6
1/1/2021 12:04:07 PM
> > 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

0
demanuel
1/1/2021 2:32:10 PM
On 1/1/21 6:32 AM, David Santiago wrote:
> say=C2=A0$_=C2=A0for=C2=A0{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 <unit> at <unknown file> line 1

0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9


 > for {0.1+$_}...^2 {print "$_\n";}
Use of uninitialized value of type Any in numeric context
   in block <unit> at <unknown file> line 1

0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9



And what is going wrong here?

for {0.3+$_}...^2 {print "$_\n";}
=2E..
41076
41076.3
41076.6
41076.9
41077.2
41077.5
41077.8
41078.1
41078.4
41078.7
41079
41079.3
41079.6
41079.9
41080.2
41080.5
41080.8
41081.1
41081.4
41081.7
=2E..



Many thanks,
-T


0
perl6
1/2/2021 1:41:04 AM
On Fri, Jan 01, 2021 at 05:41:04PM -0800, ToddAndMargo via perl6-users wr=
ote:
> On 1/1/21 6:32 AM, David Santiago wrote:
> > say=A0$_=A0for=A0{0.1+$_}...^5
>=20
> Is there a way to do this without the finger wagging?
>=20
> say $_ for {0.1+$_}...^2

If you're going to a sequence operator ("...") instead of a range operato=
r (".."), then you can specify the increment this way and it may be more =
readable:

   > say $_ for 0.1, 0.2 ...^ 2;

Raku will auto-deduce the sequence from the values in the list on the LHS=
 of the sequence operator:

   > say $_ for 0.6, 1.1 ...^ 10;

This can be of course extended -- to count from $a up to $b in steps of $=
x, one can write:

   > say $_ for $a, $a+$x ...^ $b

Note that in these examples the caret is part of the sequence operator, i=
t's not a prefix to the $b argument.

Pm
0
pmichaud
1/2/2021 6:47:12 AM
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=C2=A0$_=C2=A0for=C2=A0{0.1+$_}...^5
>>
>> Is there a way to do this without the finger wagging?
>>
>> say $_ for {0.1+$_}...^2
>=20
> If you're going to a sequence operator ("...") instead of a range opera=
tor (".."), then you can specify the increment this way and it may be mor=
e readable:
>=20
>     > say $_ for 0.1, 0.2 ...^ 2;
>=20
> Raku will auto-deduce the sequence from the values in the list on the L=
HS of the sequence operator:
>=20
>     > say $_ for 0.6, 1.1 ...^ 10;
>=20
> This can be of course extended -- to count from $a up to $b in steps of=
 $x, one can write:
>=20
>     > say $_ for $a, $a+$x ...^ $b
>=20
> Note that in these examples the caret is part of the sequence operator,=
 it's not a prefix to the $b argument.
>=20
> Pm
>=20

Hi Patrick,

Awesome explanation.   I have added the following
to my notes on "for" loops.

Anyone want to see the whole "for" notes, let me know
with a "ping Todd" on the subject line

-T



Looping using an rational (Rat, 0.45) and floating point
(Num, 0.45e0) (also avoids having to use a C loop):

    Notes: it needs two points to know the iteration value
           and an end point.

           the tripple dots

           the ^ immediately after three third dot

    # loop from 0.0 to just before 2.0 by 0.3
    > say $_ for 0.0, 0.3 ...^2.0;
    0
    0.3
    0.6
    0.9
    1.2
    1.5
    1.8

    # loop from 0.0e0 to just before 2.0e0 by 0.3e0
    > say $_ for 0.0e0, 0.3e0 ...^2e0;
    0
    0.3
    0.6
    0.8999999999999999   # chuckle!
    1.2
    1.5
    1.8


--=20
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0
perl6
1/2/2021 11:34:06 PM
Reply: