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.

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  at  line 1

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

Would you mind throwing me an REPL example?

Many thanks,
-T




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.

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


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" 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-us...@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
>
>
>


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 
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




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 # True
     8 ~~ ^9 # True
     8.9 ~~ ^9 # True

     9 ~~ ^9 # False

In the case of `for ^9 {…}` it iterates starting at 0, and continuing 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 
mailto:perl6-us...@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=4;
for ^$x -> $i { print "i = $i\n"; }

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




Thank you!



ezmlm warning

2020-12-31 Thread perl6-users-help
Hi! This is the ezmlm program. I'm managing the
perl6-us...@perl.org mailing list.

I'm working for my owner, who can be reached
at perl6-users-ow...@perl.org.


Messages to you from the perl6-users mailing list seem to
have been bouncing. I've attached a copy of the first bounce
message I received.

If this message bounces too, I will send you a probe. If the probe bounces,
I will remove your address from the perl6-users mailing list,
without further notice.


I've kept a list of which messages from the perl6-users mailing list have 
bounced from your address.

Copies of these messages may be in the archive.

To retrieve a set of messages 123-145 (a maximum of 100 per request),
send an empty message to:
   

To receive a subject and author list for the last 100 or so messages,
send an empty message to:
   

Here are the message numbers:

   9476

--- Enclosed is a copy of the bounce message I received.

Return-Path: <>
Received: (qmail 20199 invoked from network); 20 Dec 2020 10:42:04 -
Received: from xx1.develooper.com (147.75.38.233)
  by x6.develooper.com with SMTP; 20 Dec 2020 10:42:04 -
Received: by xx1.develooper.com (Postfix)
id 376557C19D; Sun, 20 Dec 2020 02:42:04 -0800 (PST)
Date: Sun, 20 Dec 2020 02:42:04 -0800 (PST)
From: mailer-dae...@xx1.develooper.com (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: perl6-users-return-9476-perl6-all-poster=perl@perl.org
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="250C47C19A.1608460924/xx1.develooper.com"
Message-Id: <20201220104204.376557c...@xx1.develooper.com>

This is a MIME-encapsulated message.

--250C47C19A.1608460924/xx1.develooper.com
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host xx1.develooper.com.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

   The mail system

: Command time limit exceeded:
"/opt/pmx/postfix/etc/spamc.sh"

--250C47C19A.1608460924/xx1.develooper.com
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; xx1.develooper.com
X-Postfix-Queue-ID: 250C47C19A
X-Postfix-Sender: rfc822; 
perl6-users-return-9476-perl6-all-poster=perl@perl.org
Arrival-Date: Sun, 20 Dec 2020 02:25:24 -0800 (PST)

Final-Recipient: rfc822; perlmail-perl6-all-pos...@onion.perl.org
Original-Recipient: rfc822;perlmail-perl6-all-pos...@onion.perl.org
Action: failed
Status: 5.3.0
Diagnostic-Code: x-unix; internal software error

--250C47C19A.1608460924/xx1.develooper.com
Content-Description: Undelivered Message
Content-Type: message/rfc822

Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1])
by localhost (Postfix) with SMTP id 250C47C19A
for ; Sun, 20 Dec 2020 
02:25:24 -0800 (PST)
Received: from mx-out1.ewr1.develooper.com (mx-out1.ewr1.develooper.com 
[139.178.64.59])
(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
(No client certificate requested)
by xx1.develooper.com (Postfix) with ESMTPS id 5E0E27C199
for ; Sun, 20 Dec 2020 02:25:18 -0800 (PST)
Received: from x6.develooper.com (unknown [147.75.38.236])
(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx-out1.ewr1.develooper.com (Postfix) with ESMTPS id D84616E08E5
for ; Sun, 20 Dec 2020 10:25:17 + (UTC)
Received: from lists-nntp.develooper.com (localhost [127.0.0.1])
by x6.develooper.com (Postfix) with SMTP id C7B4913D5
for ; Sun, 20 Dec 2020 02:25:15 -0800 (PST)
Received: (qmail 18544 invoked by uid 514); 20 Dec 2020 10:25:14 -
Mailing-List: contact perl6-users-h...@perl.org; run by ezmlm
Precedence: bulk
List-Post: 
List-Help: 
List-Unsubscribe: 
List-Subscribe: 
List-Id: 
Delivered-To: mailing list perl6-us...@perl.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perl.org; h=to
:from:subject:message-id:date:mime-version:content-type
:content-transfer-encoding:reply-to; s=dr1; bh=CKcPNcglG8prZv+sG
UEgVPyh+38TRmRN85KDsH2LgwE=; b=N2uAbAo7MqHjQHyAd6tudNZwvJkd+RObJ
Kj8oHP6psRcXJjZQMlNpJmhJwqxg0B1qOWvKJFUGZSUKzXviTF+yHzndQ+ZMZY7N
oQmV0bYVTQYLikls/sT1T3Fg/J8wbxSmlijczIfhZ7oVOdCmLWPLs8OUi/6CwEWJ
bJ9VfZvjE46ESNgYZf3cc3I9yM5yYWLQw19y5AJvV2g18KCXtSJGXrB1mNxGyc7m
v6jrbVOYq/bgf30+GxUdYrMcwhFvbIBY+MuDhlUijPijRu0IVeMtrSzAZdx1IcDb
yBsXCSfcvCP856lGgY2mZsZuzNnJzjdkww64mW71i6tGL3zqaifXQ==
Received: (qmail 18533 invoked from network); 20 Dec 2020 

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   # 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!



Re: Checking for nil return

2020-12-31 Thread Darren Duncan

On 2020-12-29 6:26 a.m., Ruud H.G. van Tol wrote:

Basically, never mix error-state and return-value.
Rather use a different channel/dimension for each.


Such a separation can't be absolute though.  One needs to be able to user-define 
routines that implement additional generic Failure related features, and in that 
case they WOULD be normal arguments or return values.  And so the regular type 
system still needs to support having anything at all as an argument or return 
value. -- Darren Duncan


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

9 ~~ ^9 # False

In the case of `for ^9 {…}` it iterates starting at 0, and continuing 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-us...@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=4;
> for ^$x -> $i { print "i = $i\n"; }
>
> i = 0
> i = 1
> i = 2
> i = 3
>
>


Re: Checking for nil return

2020-12-31 Thread yary
Moving the "can't catch Nil return, why is Nil also a failure?" question to
a Raku issue, https://github.com/Raku/doc/issues/3760

This got me going through Raku source code to see where Nil gets passed
through; this looks promising. rakudo/src/vm/moar/spesh-plugins.nqp line 308

# Allow through Nil/Failure
(nqp::istype($rv, Nil) || (nqp::istype($rv, $type) &&
...

Mostly for my own education, though if the discussion goes along the lines
of "let's make Nil not a failure" then I may look at a patch to make it so.

-y


On Wed, Dec 30, 2020 at 10:02 PM yary  wrote:

> This commit shows where Nil expanded from being "Absence of a value" to,
> alternatively, "a benign failure". Unfortunately I haven't found discussion
> on "benign failure" – semantics, use case, prior art, example, that sort of
> thing – and the commit doesn't elaborate.
>
> https://github.com/Raku/doc/commit/2b3c920ae9c37d14f76ab1eab236df2ec4f513ec
>
> I added a comment to that commit, which is now nearly 5 years old. Would
> be good to get a follow up from the committer!
>
> -y
>
>
> On Tue, Dec 29, 2020 at 9:28 AM Ruud H.G. van Tol 
> wrote:
>
>>
>> Basically, never mix error-state and return-value.
>> Rather use a different channel/dimension for each.
>>
>> And any value itself can have special state too, like "absence" and (via
>> its type) "has-default".
>>
>> On that docs-page, my stomach protested against the Nil/default pairing.
>> Now I need to think through why it (grumbled that it) is wrong.
>> (or not wrong: for performance reasons, it is good to support values
>> that can never be undefined)
>>
>> -- Ruud
>>
>>
>> On 2020-12-28 22:35, yary wrote:
>> > [...]
>> > Allowing Failure as a return always makes sense to me– every block
>> needs
>> > to be capable of passing along a failure, that's how the language is
>> > designed.
>> >
>> > On the other hand, Nil is not a Failure. Conceptually it is a lack of
>> an
>> > answer, similar to SQL's null concept.
>> >
>> > What's the usefulness of having Nil skip return type checking-
>> > specifically Nil and not its Failure descendents?
>> >
>> > This example under https://docs.raku.org/type/Nil
>> >  shows what I think is a
>> > less-than-awesome specification, and I am curious about the reasoning
>> > behind it being defined as valid
>> >
>> > suba( -->Int:D ) { return Nil }
>>
>


Re: for and ^ question

2020-12-31 Thread Andy Bach
> 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 Happy 
Tomorrow!

From: yary 
Sent: Wednesday, December 30, 2020 9:06 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 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 
mailto:perl6-us...@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
> mailto:perl6-us...@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?

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



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
> > 
> >
> > "Constructs a 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.