Re: Need regex ^? help

2024-04-29 Thread ToddAndMargo via perl6-users

On 4/29/24 17:57, Patrick R. Michaud wrote:

Perhaps not really what you're intending, but here's how I'd start:

 $ raku -e 'my $x="1.2.3.4"; $x ~~ s!\d+$!0/24!; say $x;'
 1.2.3.0/24

The pattern part of the substitution matches all of the digits at the end of the string 
(\d+$), then replaces them with the string "0/24".  Everything prior to those 
digits is left alone.

On Mon, Apr 29, 2024 at 05:45:49PM -0700, ToddAndMargo via perl6-users wrote:

On 4/29/24 17:42, ToddAndMargo via perl6-users wrote:

Hi All,

I thought I understood ^ and ? used in a regex'es,
but I don't.

^ means from the beginning and ? from the end.


I think you mean "$" here instead of "?".

Pm



Oh I did figure it out another way.  I am trying to
get a working example of ^ and $ for my Redex
keeper file


Re: Need regex ^? help

2024-04-29 Thread Patrick R. Michaud
Perhaps not really what you're intending, but here's how I'd start:

$ raku -e 'my $x="1.2.3.4"; $x ~~ s!\d+$!0/24!; say $x;'
1.2.3.0/24

The pattern part of the substitution matches all of the digits at the end of 
the string (\d+$), then replaces them with the string "0/24".  Everything prior 
to those digits is left alone.

On Mon, Apr 29, 2024 at 05:45:49PM -0700, ToddAndMargo via perl6-users wrote:
> On 4/29/24 17:42, ToddAndMargo via perl6-users wrote:
> > Hi All,
> > 
> > I thought I understood ^ and ? used in a regex'es,
> > but I don't.
> > 
> > ^ means from the beginning and ? from the end.

I think you mean "$" here instead of "?".

Pm


Re: Need regex ^? help

2024-04-29 Thread ToddAndMargo via perl6-users

On 4/29/24 17:42, ToddAndMargo via perl6-users wrote:

Hi All,

I thought I understood ^ and ? used in a regex'es,
but I don't.

^ means from the beginning and ? from the end.

I am trying to put together an example
of how to use them:

I have

    1.2.3.4

I want
    1.2.3.0/24

So Far I have (not working):

    raku -e 'my $x="1.2.3.4"; $x~~s/ (.*) $(Q[.]) /$0Q[0/24]/; say $x;'

How do I do this with ^ and $  ?

Many thanks,
-T



raku -e 'my $x="1.2.3.4"; $x~~s/ (.*) $(Q[.]) /$0$(Q[0.24])/; say $x;'
1.2.30.244





Need regex ^? help

2024-04-29 Thread ToddAndMargo via perl6-users

Hi All,

I thought I understood ^ and ? used in a regex'es,
but I don't.

^ means from the beginning and ? from the end.

I am trying to put together an example
of how to use them:

I have

   1.2.3.4

I want
   1.2.3.0/24

So Far I have (not working):

   raku -e 'my $x="1.2.3.4"; $x~~s/ (.*) $(Q[.]) /$0Q[0/24]/; say $x;'

How do I do this with ^ and $  ?

Many thanks,
-T


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


Re: Is irc.libera.chat down?

2024-04-19 Thread ToddAndMargo via perl6-users

A sex, 19-04-2024 às 03:09 -0700, Todd Chester via perl6-users
escreveu:

A sex, 19-04-2024 às 02:36 -0700, Todd Chester via perl6-users
escreveu:

Hi All,

Is
  https://kiwiirc.com/nextclient/irc.libera.chat/#raku
down?

-T




On 4/19/24 03:03, David Santiago wrote:
  >
  > It works for me.
  >
  > Regards,
  > David
  >

Hi David,

The circle just goes round and round and after
a while, it times out.

I tried both Firefox and Brave Browser.

I wonder if I got "quieted" or banned.   Is there
a way to tell?

-T


On 4/19/24 03:56, David Santiago wrote:
>
> Do you have any adblocker or any extension that blocks js? If so try to
> disable it.
>
> You can also use a dedicated client instead of the browser:
>
> www.mirc.com (for windows) or https://hexchat.github.io/ (for windows
> and linux).
>
>
> Regards,
> David Santiago

Hi David,

Did not help.  It is my username that is banned.

If memory serves, about a year ago, I logged into
it to ask a question  and someone screeded all over
me with a bunch of very creative insults.  I tried
to talk with him but got no answer back.  I did not
think much of it at the time.  I post on usenet a lot
and you develop a pretty thick skin.  After that
I was never able to get anyone to answer me.

So it is what it is.  I will jut use a different
username.  Maybe the libeler will be in a better
mood next time.

-T






Re: Is irc.libera.chat down?

2024-04-19 Thread David Santiago


Do you have any adblocker or any extension that blocks js? If so try to
disable it.

You can also use a dedicated client instead of the browser: 

www.mirc.com (for windows) or https://hexchat.github.io/ (for windows
and linux).


Regards,
David Santiago



A sex, 19-04-2024 às 03:09 -0700, Todd Chester via perl6-users
escreveu:
> > A sex, 19-04-2024 às 02:36 -0700, Todd Chester via perl6-users
> > escreveu:
> > > Hi All,
> > > 
> > > Is
> > >  https://kiwiirc.com/nextclient/irc.libera.chat/#raku
> > > down?
> > > 
> > > -T
> > 
> 
> On 4/19/24 03:03, David Santiago wrote:
>  >
>  > It works for me.
>  >
>  > Regards,
>  > David
>  >
> 
> Hi David,
> 
> The circle just goes round and round and after
> a while, it times out.
> 
> I tried both Firefox and Brave Browser.
> 
> I wonder if I got "quieted" or banned.   Is there
> a way to tell?
> 
> -T



Re: Is irc.libera.chat down?

2024-04-19 Thread Todd Chester via perl6-users




On 4/19/24 03:09, Todd Chester via perl6-users wrote:

A sex, 19-04-2024 às 02:36 -0700, Todd Chester via perl6-users
escreveu:

Hi All,

Is
 https://kiwiirc.com/nextclient/irc.libera.chat/#raku
down?

-T




On 4/19/24 03:03, David Santiago wrote:
 >
 > It works for me.
 >
 > Regards,
 > David
 >

Hi David,

The circle just goes round and round and after
a while, it times out.

I tried both Firefox and Brave Browser.

I wonder if I got "quieted" or banned.   Is there
a way to tell?

-T


I changed my username and got immediately in.
Wonder what it does not like about my user name?



Re: Is irc.libera.chat down?

2024-04-19 Thread Todd Chester via perl6-users

A sex, 19-04-2024 às 02:36 -0700, Todd Chester via perl6-users
escreveu:

Hi All,

Is
     https://kiwiirc.com/nextclient/irc.libera.chat/#raku
down?

-T




On 4/19/24 03:03, David Santiago wrote:
>
> It works for me.
>
> Regards,
> David
>

Hi David,

The circle just goes round and round and after
a while, it times out.

I tried both Firefox and Brave Browser.

I wonder if I got "quieted" or banned.   Is there
a way to tell?

-T


Re: Is irc.libera.chat down?

2024-04-19 Thread David Santiago


It works for me.

Regards,
David


A sex, 19-04-2024 às 02:36 -0700, Todd Chester via perl6-users
escreveu:
> Hi All,
> 
> Is
>     https://kiwiirc.com/nextclient/irc.libera.chat/#raku
> down?
> 
> -T



Is irc.libera.chat down?

2024-04-19 Thread Todd Chester via perl6-users

Hi All,

Is
   https://kiwiirc.com/nextclient/irc.libera.chat/#raku
down?

-T


Re: need native call help

2024-04-19 Thread Todd Chester via perl6-users




On 4/18/24 04:50, yary wrote:
I did a lot of very deep windows programming in my previous job and 
reminding me that I would always use the 8.3 short name for file 
operations! dir /x will get it for you. Must be API called for it also. 
Probably only works on local volumes not network rounded ones. Just a guess.


AreShortNamesEnabled function (fileapi.h)
https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-areshortnamesenabled

and

GetShortPathNameW function (fileapi.h)
https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getshortpathnamew

The silly "W" at the above means you have to convert your
string to UTF16.  If yo have a "A" at the end, you can
just use UTF8.  I have modules for to convert both the them.



I've run into problems on some unix shells with maximum command-line 
lengths.


-y



Hi Yary,

The 64 thousand dollar questions is should
the programming language make allowances for
the "quirks" of an operating system, such as the
260 file limit DeleteFileA, and just presume the
user of the programming language has no business
programming for the particular operating system
if he does not already know the quirks or should
the programming language make allowances?

As for me, when I throw unlink at a file, I expect it
to work or at least be told why not.  So, I think
allowances show be made.

In my DeleteFileA module, I obviously wanted it
to just work, quirks or no quirks, so I could just
go about deleting what I want without having
to be a genius at the operating system and
wasting hours troubleshooting things that don't work
as expected.

In an "ideal world", I never have to goof around
with API calls, unless I was shooting
for something really weird.

Your take?
-T


The SF Perl Raku Study Group, 04/21 at 1pm PDT

2024-04-18 Thread Joseph Brenner
  "The dilemma of the critic has always been that if he
  knows enough to speak with authority, he knows too
  much to speak with detachment."

 -- Raymond Chandler, "A Qualified Farewell" (early 1950's)

The Raku Study Group

April 21, 2024  1pm in California, 8pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
  https://us02web.zoom.us/j/84629149935?pwd=MmQ4QVIvVFR4VXdoWHVDZlIvYkV4QT09

Passcode: 4RakuRoll

RSVPs are useful, though not needed:

  https://www.meetup.com/san-francisco-perl/events/300499020/


Re: need native call help

2024-04-18 Thread yary
I did a lot of very deep windows programming in my previous job and
reminding me that I would always use the 8.3 short name for file
operations! dir /x will get it for you. Must be API called for it also.
Probably only works on local volumes not network rounded ones. Just a guess.

I've run into problems on some unix shells with maximum command-line
lengths.

-y


On Wed, 17 Apr 2024 at 11:58 PM, ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 4/17/24 19:10, William Michels via perl6-users wrote:
> > Hi Todd,
> >
> > Here are a few U StackExchange answers that I wrote using Raku's
> `unlink`:
> >
> >
> https://unix.stackexchange.com/questions/459521/how-to-truncate-file-to-maximum-number-of-characters-not-bytes/751267#751267
> >
> >
> https://unix.stackexchange.com/questions/749558/remove-exact-line-from-file-if-present-leave-the-rest-of-lines-error-handling/749581#749581
> >
> > (Suggestions welcome).
>
>
> Hi William,
>
> unlink($_) if $bak.IO:e & $bak.IO:f;
>
> Interesting!  Thank you.
>
> The problem is that you can not implicitly trust
> the file operations when programming on the kluge.
> Linux, no problem.
>
> I wish I had more Linux customers, but I do not.
>
> -T
>
> I do not know if you are, but I just append .tmp or .bak on to the name
> of my program.   I have never used Kernel32::GetTempTileNameA.
>
>
> https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamea
>


Re: need native call help

2024-04-17 Thread ToddAndMargo via perl6-users

On 4/17/24 19:10, William Michels via perl6-users wrote:

Hi Todd,

Here are a few U StackExchange answers that I wrote using Raku's `unlink`:

https://unix.stackexchange.com/questions/459521/how-to-truncate-file-to-maximum-number-of-characters-not-bytes/751267#751267

https://unix.stackexchange.com/questions/749558/remove-exact-line-from-file-if-present-leave-the-rest-of-lines-error-handling/749581#749581

(Suggestions welcome).



Hi William,

unlink($_) if $bak.IO:e & $bak.IO:f;

Interesting!  Thank you.

The problem is that you can not implicitly trust
the file operations when programming on the kluge.
Linux, no problem.

I wish I had more Linux customers, but I do not.

-T

I do not know if you are, but I just append .tmp or .bak on to the name 
of my program.   I have never used Kernel32::GetTempTileNameA.


https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamea


Perl and Raku Conference, late June, Las Vegas

2024-04-17 Thread Bruce Gray
In case you had not heard, Raku content will (unsurprisingly) be part of The 
Perl and Raku Conference, June 24th through 28th in Las Vegas. 

(Come to think of it, if you hadn't heard about this conference *at* *all*, and 
you are a Raku user, please email me personally, so we will know in the future 
how many Raku users are getting community info *only* from this email list. 
Thanks!)

I don't see the conference mentioned in the archives of this mailing list, so I 
am mentioning now.
...less than three days before the deadline to submit Raku content.
(I blame Util.)

There is no hard deadline for *attending* the conference, but now is a good 
time to book the hotel and plan your travel.
This conference has a rich history of awesome, and I recommend it for even 
tangential users of Raku.
(Also, Las Vegas has great shows, and is near an impressive gaping maw in the 
earth.)

Original information:

https://www.reddit.com/r/rakulang/comments/1bpd7qd/the_perl_and_raku_conference_talks_submission_is/

Extra request for presentations (especially Raku), and clarification about the 
new Science track:

https://www.reddit.com/r/rakulang/comments/1c5qglk/raku_science_and_speakers_for_tprconference/

-- 
Hope to see you there,
Bruce Gray (Util of PerlMonks)



Re: need native call help

2024-04-17 Thread William Michels via perl6-users
Hi Todd, 

Here are a few U StackExchange answers that I wrote using Raku's `unlink`:

https://unix.stackexchange.com/questions/459521/how-to-truncate-file-to-maximum-number-of-characters-not-bytes/751267#751267

https://unix.stackexchange.com/questions/749558/remove-exact-line-from-file-if-present-leave-the-rest-of-lines-error-handling/749581#749581

(Suggestions welcome).

HTH, Bill

> On Apr 17, 2024, at 17:14, ToddAndMargo via perl6-users 
>  wrote:
> 
> On 4/17/24 05:52, yary wrote:
>> From unlink's documentation:
>> If the file to be deleted does not exist, the routine treats it as success.
>> So trying to delete a file that isn't there, doesn't have an error, which is 
>> kind of neat, but that is a difference from native delete.
>> -y
> 
> Hi Yary,
> 
> Not to beat a dead horse, but when does that stop me!
> 
> 
> In Windows, if the filename/path exceeds 260 characters
> (MAX_PATH), unlink will think that the file does not
> exist and will let you blissfully think it has been removed,
> when in reality, it is still there.
> 
> -T



Re: need native call help

2024-04-17 Thread ToddAndMargo via perl6-users

On 4/17/24 05:52, yary wrote:

 From unlink's documentation:

If the file to be deleted does not exist, the routine treats it as success.

So trying to delete a file that isn't there, doesn't have an error, 
which is kind of neat, but that is a difference from native delete.


-y


Hi Yary,

Not to beat a dead horse, but when does that stop me!


In Windows, if the filename/path exceeds 260 characters
(MAX_PATH), unlink will think that the file does not
exist and will let you blissfully think it has been removed,
when in reality, it is still there.

-T


Re: need native call help

2024-04-17 Thread ToddAndMargo via perl6-users

On 4/17/24 05:52, yary wrote:

 From unlink's documentation:

If the file to be deleted does not exist, the routine treats it as success.

So trying to delete a file that isn't there, doesn't have an error, 
which is kind of neat, but that is a difference from native delete.


-y



Hi Yary,

Not neat at all.  And that would be a bug that need
to be fixed.  I spend hours trying to troubleshoot
why I could not delete a file.

1) it should return "File not Found"

and

2) it should return "MAX_PATH exceed in file name"
if that is the case and `\\?\` has not been prepended.
And if such, recommend adding `\\?\`.  Or just
add it automatically as my ApiDeleteFile module
does.


This is Windows we are dealing with after all.

Oh look how it is done in Linux when deleting a
non-existent file:

$ rm abc.txt ; echo $?
rm: cannot remove 'abc.txt': No such file or directory
1

The "No such file or directory" is self explanatory.

The "1" from the echo of "$?" means the command failed,
unlike the no error return from Raku's unlink.  Unlink
need to be fixed.

-T






Re: need native call help

2024-04-17 Thread ToddAndMargo via perl6-users

On 4/17/24 05:50, yary wrote:
What does the windows native delete do which you need, that raku's 
unlink doesn't have?


without unlink $FileName { say "Could not delete $FileName:", 
.exception.message };


-y


Hi Yary,

This is Windows we are dealing with.  It is a kluge.
I have had unlink fail and could not figure out why.

DeleteFileA has wonderful error reporting, well
for Windows.  And you can always count on it doing
things right.  Well, again, maybe..

What caused me to do all this was my inability to delete
the following from the command shell, powershell, and
(Raku) unlink.  But I could delete from Windows Explorer.
I kept getting told the command could not find
the file.   H!

D:\MyDocsBackup\backup2\Mozilla 2024-03-26 16;10;20 
(Full)\Firefox\Profiles\pj0elosu.default-release\storage\default\https+++505991220932649.webpush.freshchat.com^partitionKey=%%28https%%2Cbid13.com%%29\cache\morgue\114\{7cccd5e9-a7aa-4349-a2e9-569baf007272}.final


I had originally thought that the issue was the "weird" characters.
All my attempts to escape the failed.  So out of desperation,
I switched to DeleteFileA.

On DeleteFileA's web page was the give away:

'Tip  Starting with Windows 10, Version 1607, you can
opt-in to remove the MAX_PATH limitation without
prepending "\\?\"'

And I did not realize this a first, but a thorough reading
of the web page and I finally understood.  The file I
was trying to delete was 265 characters long and the
limit (MAX_PATH) was 260.  The commands I was trying
were lopping off five of the characters.  And the commands
did not tell me I had exceeded MAX_PATH.  (This is M$ we
are dealing with after all.)

Now you all that live sheltered lives with Linux, this would
not be an issue.  But the kluge, it is.  You can have to
different max lengths and you have to know when and when
not to prepend.  I am sorry, but what poor programming
on M$'s part.  (Prepending works on shorter files, but
takes longer to process and sometimes coughs.)

You will notice my modules a few things:

1) if the length of the path/name exceeds MAX_PATH and the
path/name does not include \\?\`, then I prepend it.

2) if DeleteFileA return pass, I send back "OK" in the
string.  If not, I send back the error message from
Kernel32::GetLastError" (returns a number) and
Kernel32::WinFormatMessage (translates the error
number to text).

So now I have a powerful tool in addition to unlink in my
tool box to cope with the kluge.

In Linux, I will use unlink, but in the kluge, I will probably
use my ApiDeleteFile.

It never hurts to have enough tools.

-T

Me wonders why Windows programmers do not tear
all their hair out.




Re: PostgreSQL: Raku as a "trusted" language?

2024-04-17 Thread JJ Merelo
>From what I'm seeing, my impression is that you need to create a specific
version, possibly with Pg bindings, to become either trusted or untrusted;
there's no Trusted "node" (or bun, for that matter), but a "v8js" version
of JavaScript.

Any PL (procedural language) version of the language would be used to
create embedded procedures. The user base for such a thing does not
guarantee the effort needed to create such a version of Rakudo (which, from
what I can tell, would need to be refactored at the NPQ level, since
"trusted" versions can't, for instance, access the filesystem)

El mié, 17 abr 2024 a las 21:04, William Michels via perl6-users (<
perl6-users@perl.org>) escribió:

> Hi,
>
> Thinking about which database to use with Raku, I started following a
> question from StackOverflow--here:
>
> "list of PostgreSQL trusted languages?"
>
> https://dba.stackexchange.com/questions/156631/list-of-postgresql-trusted-languages
>
> From that page I learned that there are both "trusted" and "untrusted"
> modes for use of Perl with PostgreSQL:
>
> "45.5. Trusted and Untrusted PL/Perl"
> https://www.postgresql.org/docs/current/plperl-trusted.html
>
> Which led me to a matrix of programming languages and trust modes:
>
> "PL Matrix"
> https://wiki.postgresql.org/wiki/PL_Matrix
>
> On the final PL link above, Raku doesn't appear at all--so the questions
> arise:
>
> 1. How can the Raku community get Raku added on the "PL Matrix" page?
>
> 2. How can the Raku community get Raku accepted as a "trusted" PL for use
> with PostgreSQL?
>
>
> Thx,
>
> Bill.
>
>

-- 
JJ


PostgreSQL: Raku as a "trusted" language?

2024-04-17 Thread William Michels via perl6-users
Hi, 

Thinking about which database to use with Raku, I started following a question 
from StackOverflow--here:

"list of PostgreSQL trusted languages?"
https://dba.stackexchange.com/questions/156631/list-of-postgresql-trusted-languages

From that page I learned that there are both "trusted" and "untrusted" modes 
for use of Perl with PostgreSQL:

"45.5. Trusted and Untrusted PL/Perl"
https://www.postgresql.org/docs/current/plperl-trusted.html

Which led me to a matrix of programming languages and trust modes:

"PL Matrix"
https://wiki.postgresql.org/wiki/PL_Matrix

On the final PL link above, Raku doesn't appear at all--so the questions arise:

1. How can the Raku community get Raku added on the "PL Matrix" page?

2. How can the Raku community get Raku accepted as a "trusted" PL for use with 
PostgreSQL?


Thx,

Bill.



Re: need native call help

2024-04-17 Thread yary
>From unlink's documentation:

 If the file to be deleted does not exist, the routine treats it as success.

So trying to delete a file that isn't there, doesn't have an error, which
is kind of neat, but that is a difference from native delete.

-y


On Wed, Apr 17, 2024 at 8:50 AM yary  wrote:

> What does the windows native delete do which you need, that raku's unlink 
> doesn't
> have?
>
> without unlink $FileName { say "Could not delete $FileName:", 
> .exception.message
> };
>
> -y
>
>
> On Wed, Apr 17, 2024 at 2:29 AM ToddAndMargo via perl6-users <
> perl6-users@perl.org> wrote:
>
>> On 4/16/24 23:25, ToddAndMargo via perl6-users wrote:
>> `\\>\` should have been
>> `\\?\`
>>
>>


Re: need native call help

2024-04-17 Thread yary
What does the windows native delete do which you need, that raku's
unlink doesn't
have?

without unlink $FileName { say "Could not delete $FileName:",
.exception.message
};

-y


On Wed, Apr 17, 2024 at 2:29 AM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 4/16/24 23:25, ToddAndMargo via perl6-users wrote:
> `\\>\` should have been
> `\\?\`
>
>


Re: need native call help

2024-04-17 Thread ToddAndMargo via perl6-users

On 4/16/24 23:25, ToddAndMargo via perl6-users wrote:
`\\>\` should have been
`\\?\`



Re: need native call help

2024-04-17 Thread ToddAndMargo via perl6-users

On 4/16/24 20:57, ToddAndMargo via perl6-users wrote:


    $LongName = $FileName;
    if $FileName.chars >= MAX_PATH  { $LongName = Q[\\?\] ~ $FileName; }


What the about is all about is that MAX_PATH, which
limits the file name to 260 characters, can go up to
32,767 wide characters, prepend "\\?\" to the path.

I altered the above line since posting to:

   $LongName = $FileName;
   if $FileName.chars >= MAX_PATH  &&  not $FileName.starts-with( 
Q[\\?] )  {

   $LongName = Q[\\?\] ~ $FileName;
   }


in case I forget that my module prepends the `\\>\` if
I exceed MAX_PATH




Re: need native call help

2024-04-16 Thread ToddAndMargo via perl6-users

On 4/16/24 18:43, ToddAndMargo via perl6-users wrote:

On 4/16/24 01:21, ToddAndMargo via perl6-users wrote:

Hi All,

Windows 11

It has been so long that I have done one of these that
my brain is seizing.

https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea

C++

BOOL DeleteFileA(
   [in] LPCSTR lpFileName
);


Would some kind soul please show me how to do this again?

Many thanks,
-T


I got a good night's sleep and my head unfroze.

I figured it out.  I will post back how in a
few days or so.

-T




Hi All,

https://docs.raku.org/language/nativecall
is a wonderful documeht, but as far as I can
tell, they do not breakdown how to make an
API call.  They expect you to already know how
to do it.  So not for the beginners.

This is the code I came up with.  There is a lot
of the my libraries missing from this, if you want
them, I can eMail them to you.  I am only posting
this so you can get the idea of how to do this:

-T

# unit module NativeDelete;
# NativeDelete.rakumod

#`{

   Delete a filed directory with the Windows DeleteFileA function
   (fileapi.h) API with NativeCall.


https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea
   https://docs.raku.org/language/nativecall

   To use, place the following at the top of your program:

   use NativeDelete :ApiDeleteFile;
   use NativeCall;
   use NativeConstants;
   use NativeConvert :to-UTF8-c-str;
   use WinErr :WinGetLastError, :WinFormatMessage;

   Test one liner:
  Note: in Windows Explorer, right click on the file, left click on 
copy as path,
then paste the entire path.  Note the `\\?\` at the 
beginning for long file names.


  K:\Windows\NtUtil>echo abc > eraseme.txt && raku -I. -e "use 
NativeDelete :ApiDeleteFile; say ApiDeleteFile( Q[eraseme.txt] )" && 
type eraseme.txt

  OK
  The system cannot find the file specified.

  K:\Windows\NtUtil>echo abc > eraseme.txt && raku -I. -e "use 
NativeDelete :ApiDeleteFile; say ApiDeleteFile( Q[eraseme2.txt] )" && 
type eraseme.txt

  The system cannot find the file specified.
  abc

  raku -I. -e "use NativeDelete :ApiDeleteFile; say ApiDeleteFile( 
Q[\\?\D:\MyDocsBackup\backup2\Mozilla 2024-04-15 21;14;31 
(Full)\Firefox\Profiles\pj0elosu.default-release\storage\default\https+++505991220932649.webpush.freshchat.com^partitionKey=%28https%2Cbid13.com%29\cache\morgue\114\{7cccd5e9-a7aa-4349-a2e9-569baf007272}.final] 
);"

  OK

}

use NativeCall;
use NativeConstants;
use NativeConvert :to-UTF8-c-str;
use WinErr :WinGetLastError, :WinFormatMessage;


sub DeleteFileA(
   #`{
   C++
 BOOL DeleteFileA(
 [in] LPCSTR lpFileName
   );
   }

   CArray[uint8] $lpFileName
   )
   is native("Kernel32.dll")
   is symbol("DeleteFileA")
   returns BOOL
   { * };


sub ApiDeleteFile( Str $FileName ) returns Str is export( :ApiDeleteFile ) {
#`{
$FileName is the file name and optional path path
Format:  Q[D:\NtUtil\eraseme.txt]   Note the backslashes.

Returned "OK" if successful or the error message if not

Syntax
C++

BOOL DeleteFileA(
   [in] LPCSTR lpFileName
);
DLL Kernel32.dll

Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero (0). To get 
extended error information, call GetLastError.


By default, the name is limited to MAX_PATH characters. To extend 
this limit to 32,767

wide characters, prepend "\\?\" to the path.

If using `\\?\` you must use the full path.

}

   my DWORD $LastError   = 0;
   my Str   $WinErrorMsg = "OK";
   my BOOL  $RtnValue= 1;
   my Str   $LongName= "";

   $LongName = $FileName;
   if $FileName.chars >= MAX_PATH  { $LongName = Q[\\?\] ~ $FileName; }

   my CArray[uint8] $lpFileName = to-UTF8-c-str( $LongName );
   $RtnValue = DeleteFileA( $lpFileName );

   sub GetLastError() is native("Kernel32") is symbol("GetLastError") 
returns DWORD { * };



   if $RtnValue == 0  {
  $LastError   = GetLastError();
  $WinErrorMsg = WinFormatMessage( $LastError );
   }
   return $WinErrorMsg;

}









Re: need native call help

2024-04-16 Thread ToddAndMargo via perl6-users

On 4/16/24 01:21, ToddAndMargo via perl6-users wrote:

Hi All,

Windows 11

It has been so long that I have done one of these that
my brain is seizing.

https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea

C++

BOOL DeleteFileA(
   [in] LPCSTR lpFileName
);


Would some kind soul please show me how to do this again?

Many thanks,
-T


I got a good night's sleep and my head unfroze.

I figured it out.  I will post back how in a
few days or so.

-T



need native call help

2024-04-16 Thread ToddAndMargo via perl6-users

Hi All,

Windows 11

It has been so long that I have done one of these that
my brain is seizing.

https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea

C++

BOOL DeleteFileA(
  [in] LPCSTR lpFileName
);


Would some kind soul please show me how to do this again?

Many thanks,
-T


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


The SF Perl Raku Study Group, 04/07 at 1pm PDT

2024-04-06 Thread Joseph Brenner
"I do not think that society ought to maltreat men of genius as it has
done hitherto; but neither do I think it should indulge them too far,
still less accord them any privileges or exclusive rights whatsoever;
and that for three reasons: first, because it would often mistake a
charlatan for a man of genius; second, because, through such a system
of privileges, it might transform into a charlatan even a real man of
genius, demoralize him, and degrade him; and, finally, because it
would establish a master over itself."

   -- Mikhail Bakunin, "God and the State" (1882)

The Raku Study Group

April 7, 2024  1pm in California, 8pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
  https://us02web.zoom.us/j/88998480871?pwd=OFdRbnZXNXJON1kwbGpyTUgyMkYwQT09

Passcode: 4RakuRoll


The SF Perl Raku Study Group, 03/34 at 1pm PDT

2024-03-22 Thread Joseph Brenner
Margaret Masterman, "The Nature of a Paradigm" (1970):

"This pre-scientific and philosophic state of affairs sharply
contrasts, however, with *multi-paradigm science*, with that state
of affairs in which, far from there being no paradigm, there are
on the contrary too many.  (This is the present overall situation
in the psychological, social and information sciences.)  ... each
sub-field as defined by its technique is so obviously more trivial
and narrow than the field as defined by intuition, and also the
various operational definitions given by the techniques are so
grossly discordant with one another, that discussion on
fundamentals remains, and long-run progress (as opposed to local
progress) fails to occur.  This state of affairs is brought to an
end when someone invents a deeper, though cruder paradigm ..."

The Raku Study Group

March 24, 2024  1pm in California, 8pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
  https://us02web.zoom.us/j/89784337896?pwd=bjF4MmdnWU0zMUpoTndMOHVJQzVTdz09

Passcode: 4RakuRoll

RSVPs are useful, though not needed:

  https://www.meetup.com/san-francisco-perl/events/299953269/


Re: I need sorting help

2024-03-16 Thread ToddAndMargo via perl6-users

On 3/2/24 05:13, Elizabeth Mattijsen wrote:

$ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try 
.Numeric) // $_}).List)
afoo2
afoo12



On 2 Mar 2024, at 07:26, ToddAndMargo via perl6-users  
wrote:

Hi All,

@Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self 
})};

gives me

   Element [0]  
   Element [1]  
   Element [2]  
   Element [3]  
   Element [4]  
   Element [5]  
   Element [6]  
   Element [7]  
   Element [8]  
   Element [9]  

I need it to say

   Element [0]  
   Element [1]  
   Element [2]  
   Element [3]  
   Element [4]  
   Element [5]  
   Element [6]  
   Element [7]  
   Element [8]  
   Element [9]  

What did I goof up, this time?

Many thanks,
-T





Hi Liz,

Look what you have done to me!

$ raku -e '.say for bk-3.41.0.0>.sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List)'


bk-1.0.4.5
bk-1.1.0.9
bk-2.1.4.3
bk-3.4.1.5
bk-3.41.0.0

Awesome!
-T

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



Re: MAIN(*magic)

2024-03-15 Thread Bruce Gray


> On Mar 14, 2024, at 21:57, Mark Devine  wrote:
> 
> Rakoons,
>  
> I keep running into a space with Raku where it would be nice to have some 
> magic to reduce boilerplate.  I often make roles & classes with interface 
> options that flow from a consuming script’s MAIN arguments, then the first 
> bit of code at the top the MAIN block, then into instantiation.  If a person 
> makes nice utility libraries with lots of options for the user & employs them 
> a lot, the time consumed typing out the boilerplate adds up & bloats the 
> code.  Is there any way to shorten this pattern?  I was thinking about a 
> ‘switchable’ trait for attributes (with the naivety of a schoolboy).
>  
> my class Output {
> has $.csv  is switchable;
> has $.html is switchable;
>   .
>   .
>   .
> has $.xml is switchable;
> }
>  
> my class Timer {
> has $.countis switchable;
> has $.expire   is switchable;
> has $.interval is switchable;
> }
>  
> sub MAIN (
> Output.switchables, #= switchables from Class 'Output'
> Timer.switchables,  #= switchables from Class 'Timer'
> ) {
> my Timer $t.= new: :$expire, :$interval, :$count;   # variables 
> magically appear in scope
> my Output $o   .= new: :$csv, :$html, … , :$xml;# variables 
> magically appear in scope
> }
>  
> I estimate 10-50 lines of boilerplate could be removed from most of my Raku 
> scripts with something like that.  Unfortunately, I don’t possess any dark 
> magic for such things or I’d put forward an attempt.
>  
> Thanks,
>  
> Mark

Like lizmat, I also see no way to achieve your goal using the "is switchable" 
approach you have posited.
However, the thought of removing so much boilerplate pricks my thumbs, Ostara 
approaches, and it just turned midnight here, so Dark Magic will be attempted.

Thoughts:
* You don't need to have a $expire variable, or materialize any variable to 
allow feeding a CLI argument to a class' `.new()` constructor. You can skim off 
the arguments from @*ARGS, the same way many of the Getopt:: modules do. If you 
need them later, you can get them from the built object, e.g. `$t.count`.
* I expect is is harmless to expose *all* of the BUILDable attributes of the 
interfaced object types (which we can get via introspection!), so no need to 
mark individual attributes; you could mark the class itself with `is 
switchable`. 
* We could automate that `is switchable` (now for the whole class instead of 
its attributes) with a role, but why? More flexible to wrap (via module) *any* 
class/module with an OO API, even if not your own code! Proof-of-concept below.

Outline:
use Getopt::Attributes; # Not a real module (yet!)
my $sc = auto-cli( SomeClass );
sub MAIN ( ...just normal params, no need to list the params for all 
the objects built with `auto-cli`...  ) {
... code here can use `$sc`, which was created using args from 
the command-line ...
}


Test runs of code below:
$ raku poc_01.raku --count=5 --xml=foo.xml myfile.txt 
Timer  object  Timer.new(count => 5, expire => Any, interval => Any)
Output object  Output.new(csv => Any, html => Any, xml => "foo.xml", logger 
=> "localhost")
Remaining ARGS [myfile.txt]
Filename   myfile.txt

$ raku poc_01.raku --count=5 --xml=foo.xml --logger=abc myfile.txt 
Timer  object  Timer.new(count => 5, expire => Any, interval => Any)
Output object  Output.new(csv => Any, html => Any, xml => "foo.xml", logger 
=> "abc")
Remaining ARGS [myfile.txt]
Filename   myfile.txt

$ raku poc_01.raku myfile.txt 
Timer  object  Timer.new(count => Any, expire => Any, interval => Any)
Output object  Output.new(csv => Any, html => Any, xml => Any, logger => 
"localhost")
Remaining ARGS [myfile.txt]
Filename   myfile.txt



Actual proof-of-concept in a single file: poc_01.raku

# XXX In a fully-realized solution, this part would be in its own module.
# If it was Getopt::Attributes , it would live in 
lib/Getopt/Attributes.rakumod
# unit class Getopt::Attributes:ver<0.0.1>;

# Given a class, `auto-cli` introspects that class for its public accessors, 
knowing that those are valid named parameters for the class constructor. It 
then does a scan on @*ARGS, removing arguments that could be intended for that 
class. This must happen *before* MAIN runs, or MAIN will throw a USAGE error on 
the unexpected (from MAIN's perspective) arguments. The removed command-line 
arguments are merged with any provided defaults, and an instance of that class 
with the merged named arguments.
sub auto-cli ( Any:U $class, *%defaults ) is export {
my %opt = %defaults;

my @attrs = $class.^attributes
  .grep( *.has_accessor )
  .map(  *.name.subst(/^\S\S/) );
my $attr_re = /@attrs/;

for @*ARGS.keys.reverse -> $i {
if @*ARGS[$i] ~~ / ^ '--' ($attr_re) '=' (\S+) $ / {
my ($key, 

Re: MAIN(*magic)

2024-03-15 Thread Elizabeth Mattijsen
> On 15 Mar 2024, at 03:57, Mark Devine  wrote:
> 
> Rakoons,
>  I keep running into a space with Raku where it would be nice to have some 
> magic to reduce boilerplate.  I often make roles & classes with interface 
> options that flow from a consuming script’s MAIN arguments, then the first 
> bit of code at the top the MAIN block, then into instantiation.  If a person 
> makes nice utility libraries with lots of options for the user & employs them 
> a lot, the time consumed typing out the boilerplate adds up & bloats the 
> code.  Is there any way to shorten this pattern?  I was thinking about a 
> ‘switchable’ trait for attributes (with the naivety of a schoolboy).
>  my class Output {
> has $.csv  is switchable;
> has $.html is switchable;
>   .
>   .
>   .
> has $.xml is switchable;
> }
>  my class Timer {
> has $.countis switchable;
> has $.expire   is switchable;
> has $.interval is switchable;
> }
>  sub MAIN (
> Output.switchables, #= switchables from Class 'Output'
> Timer.switchables,  #= switchables from Class 'Timer'
> ) {
> my Timer $t.= new: :$expire, :$interval, :$count;   # variables 
> magically appear in scope
> my Output $o   .= new: :$csv, :$html, … , :$xml;# variables 
> magically appear in scope
> }
>  I estimate 10-50 lines of boilerplate could be removed from most of my Raku 
> scripts with something like that.  Unfortunately, I don’t possess any dark 
> magic for such things or I’d put forward an attempt.

An interesting idea!

Unfortunately I don't see this happening in the legacy grammar.  And it may 
still be pretty hard to do in RakuAST.

If you'd want to have a solution now, I'd look at *generating* the boilerplate 
code where appropriate.  This approach is used in the core in several 
locations, most notably recently in the localization modules.


Liz



MAIN(*magic)

2024-03-14 Thread Mark Devine
Rakoons,



I keep running into a space with Raku where it would be nice to have some magic 
to reduce boilerplate.  I often make roles & classes with interface options 
that flow from a consuming script’s MAIN arguments, then the first bit of code 
at the top the MAIN block, then into instantiation.  If a person makes nice 
utility libraries with lots of options for the user & employs them a lot, the 
time consumed typing out the boilerplate adds up & bloats the code.  Is there 
any way to shorten this pattern?  I was thinking about a ‘switchable’ trait for 
attributes (with the naivety of a schoolboy).



my class Output {

has $.csv  is switchable;

has $.html is switchable;

  .

  .

  .

has $.xml is switchable;

}



my class Timer {

has $.countis switchable;

has $.expire   is switchable;

has $.interval is switchable;

}



sub MAIN (

Output.switchables, #= switchables from Class 'Output'

Timer.switchables,  #= switchables from Class 'Timer'

) {

my Timer $t.= new: :$expire, :$interval, :$count;   # variables 
magically appear in scope

my Output $o   .= new: :$csv, :$html, … , :$xml;# variables 
magically appear in scope

}



I estimate 10-50 lines of boilerplate could be removed from most of my Raku 
scripts with something like that.  Unfortunately, I don’t possess any dark 
magic for such things or I’d put forward an attempt.



Thanks,



Mark


Re: I need sorting help

2024-03-09 Thread Ralph Mellor
On Sat, Mar 9, 2024 at 7:52 PM yary  wrote:

> how to sort by alpha & numeric segments (b3b, a1a, c20c) =>  (a1a, b3b, c2c)

Ahhh. D'oh. Thanks! 

Now I see what was required, or at least think I do:

.sort: {m:g/ \d+{make +$/} | \D+{make ~$/} /».made}

That does what was meant, right?

--
love, raiph


Re: I need sorting help

2024-03-09 Thread yary
Using my quick-intuition, are these methods sorting on the earliest number
withing the string, ignoring the non-digits?

$ raku -e '.say for .sort: {m/ \d+ /.Int}'
$ raku -e '.say for .sort: +*.match: / \d+ /'

let's see

$ raku -e '.say for .sort: {m/ \d+ /.Int}'
it1
does2
not3
matter10
what20
the30letters40
say31

What's been interesting about this thread is not only the variety of
solutions, also that the solutions are for two different questions-

how to sort by alpha & numeric segments (b3b, a1a, c20c) =>  (a1a, b3b, c2c)
how to sort by a numeric segment only (b3b, a1a, c20c) =>  (a1a, b3b, c20c)

-y


On Thu, Mar 7, 2024 at 4:40 PM Ralph Mellor  wrote:

> On Tue, Mar 5, 2024 at 7:01 AM ToddAndMargo via perl6-users
>  wrote:
>
> > >> $ raku -e '.say for .sort(*.split(/\d+/,
> :kv).map({ (try .Numeric) // $_}).List)'
> > >>
> > >> Yippee!
>
> > > raku -e '.say for .sort: { .comb(/ \d+ | \D+
> /).map({ .Int // .self }).cache };'
> >
> > Awesome!  Now I have two different methods!
>
> And now 4:
>
> $ raku -e '.say for .sort: {m/ \d+ /.Int}'
> bk1
> bk2
> bk10
> bk34
>
> or, same logic, but spelled differently:
>
> $ raku -e '.say for .sort: +*.match: / \d+ /'
> bk1
> bk2
> bk10
> bk34
>
> --
> love, raiph
>


Re: The SF Perl Raku Study Group, 04/10 at 1pm Pacific Time

2024-03-07 Thread Joseph Brenner
And this:

> March 10th, 2024  1pm in California, 9pm in the UK

Should've read "8pm in the UK".


On 3/7/24, Joseph Brenner  wrote:
> Note: Here in the US, we are about to "spring ahead" one mooorre time,
> and the 1pm I'm referring to is an hour earlier than many of you expect.
>
>"It's becoming increasingly unusual to read a report of a new
>technology or scientific discovery that doesn't breathlessly
>use the phrase 'it seems like science fiction'. The news
>cycle is currently dominated by hype about artificial
>intelligence (a gross mis-characterisation of machine
>learning algorithms and large language models). A couple of
>years ago it was breathless hype about cryptocurrency and
>blockchain technologies-- which turned out to be a financial
>services bubble ... "
>
>-- Charles Stross, November 10th, 2023,
>"We're sorry we created the Torment Nexus"
>
> The Raku Study Group
>
> March 10th, 2024  1pm in California, 9pm in the UK
>
> An informal meeting: drop by when you can, show us what you've got,
> ask and answer questions, or just listen and lurk.
>
> Perl and programming in general are fair game, along with Raku,
>
> Zoom meeting link:
>
> https://us02web.zoom.us/j/87052612966?pwd=cExtbzJLVkIyUGVZRGlYWlBBRTg1dz09
>
> Passcode: 4RakuRoll
>
> RSVPs are useful, though not needed:
>   https://www.meetup.com/san-francisco-perl/events/299663054/
>


The SF Perl Raku Study Group, 04/10 at 1pm Pacific Time

2024-03-07 Thread Joseph Brenner
Note: Here in the US, we are about to "spring ahead" one mooorre time,
and the 1pm I'm referring to is an hour earlier than many of you expect.

   "It's becoming increasingly unusual to read a report of a new
   technology or scientific discovery that doesn't breathlessly
   use the phrase 'it seems like science fiction'. The news
   cycle is currently dominated by hype about artificial
   intelligence (a gross mis-characterisation of machine
   learning algorithms and large language models). A couple of
   years ago it was breathless hype about cryptocurrency and
   blockchain technologies-- which turned out to be a financial
   services bubble ... "

   -- Charles Stross, November 10th, 2023,
   "We're sorry we created the Torment Nexus"

The Raku Study Group

March 10th, 2024  1pm in California, 9pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
  https://us02web.zoom.us/j/87052612966?pwd=cExtbzJLVkIyUGVZRGlYWlBBRTg1dz09

Passcode: 4RakuRoll

RSVPs are useful, though not needed:
  https://www.meetup.com/san-francisco-perl/events/299663054/


Re: I need sorting help

2024-03-07 Thread Ralph Mellor
On Tue, Mar 5, 2024 at 7:01 AM ToddAndMargo via perl6-users
 wrote:

> >> $ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ 
> >> (try .Numeric) // $_}).List)'
> >>
> >> Yippee!

> > raku -e '.say for .sort: { .comb(/ \d+ | \D+ /).map({ 
> > .Int // .self }).cache };'
>
> Awesome!  Now I have two different methods!

And now 4:

$ raku -e '.say for .sort: {m/ \d+ /.Int}'
bk1
bk2
bk10
bk34

or, same logic, but spelled differently:

$ raku -e '.say for .sort: +*.match: / \d+ /'
bk1
bk2
bk10
bk34

--
love, raiph


Re: pint: Elizabeth, sort list???

2024-03-07 Thread Marc Chantreux
hello,

>  ==> sort({ | map { +$_ // $_ }, .split: /\d+/, :v }) ==> say()

ok … so I'm lost but I'm not even curious to understand why (because of
my lack of interest for the ==> operator :))

regards
marc

-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79



Re: pint: Elizabeth, sort list???

2024-03-07 Thread Fernando Santagata
Hi Marc,

This works:

 ==> sort({ | map { +$_ // $_ }, .split: /\d+/, :v }) ==>
say()

As the documentation says here https://docs.raku.org/routine/%3D%3D%26gt%3B

The precedence is very loose so you will need to use parentheses to assign
the result



On Thu, Mar 7, 2024 at 8:37 AM Marc Chantreux  wrote:

> hello,
>
> > How would you write that expression using the feed operator?
>
> I tried
>
> < afoo12 afoo2 >
> ==> {.sort: { | map { +$_ // $_ }, .split: /\d+/, :v }}
> ==> {map }
>
> and the error message is really interesting
>
> Only routine calls or variables that can '.append' may
> appear on either side of feed operators.
>
> on the other hand: I really don't understand why ==> even exists
> as method call syntax works well.
>
> < afoo12 afoo2 >
> .sort( { | map { +$_ // $_ }, .split: /\d+/, :v } )
> .map()
>
> what I would love instead is something closer than the haskell's $
> operator with a very low priority so it could be possible to be
> parenthesis free.
>
> as example. I would like
>
> 1..10 ==> map * * 2 ==> say
>
> to be a joyful version of
>
> (1..10).map(* * 2).say
>
> regards
>
> --
> Marc Chantreux
> Pôle CESAR (Calcul et services avancés à la recherche)
> Université de Strasbourg
> 14 rue René Descartes,
> BP 80010, 67084 STRASBOURG CEDEX
> 03.68.85.60.79
>
>

-- 
Fernando Santagata


Re: pint: Elizabeth, sort list???

2024-03-07 Thread Marc Chantreux
hello,

> How would you write that expression using the feed operator?

I tried

< afoo12 afoo2 >
==> {.sort: { | map { +$_ // $_ }, .split: /\d+/, :v }}
==> {map }

and the error message is really interesting

Only routine calls or variables that can '.append' may
appear on either side of feed operators.

on the other hand: I really don't understand why ==> even exists
as method call syntax works well.

< afoo12 afoo2 >
.sort( { | map { +$_ // $_ }, .split: /\d+/, :v } )
.map()

what I would love instead is something closer than the haskell's $
operator with a very low priority so it could be possible to be
parenthesis free.

as example. I would like

1..10 ==> map * * 2 ==> say

to be a joyful version of

(1..10).map(* * 2).say

regards

-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79



Re: pint: Elizabeth, sort list???

2024-03-06 Thread Jim Bollinger
Hi Elizabeth!

How would you write that expression using the feed operator?

Thanks,

Shimon

> On Mar 3, 2024, at 7:22 AM, Elizabeth Mattijsen  wrote:
> 
>> On 3 Mar 2024, at 03:32, ToddAndMargo via perl6-users  
>> wrote:
>> 
>>> On 3/2/24 05:13, Elizabeth Mattijsen wrote:
 .sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List)
>> 
>>> Hi Elizabeth,
>>> It works perfectly.  Thank you!
>>> I have no idea why, I will ask you in another post
>> Would you take apart your sort piece by piece and explain
>> each part?
> 
> Actually, the expression can be refined a bit:
> 
> say .sort(*.split(/\d+/, :v).map({ (try .Int) // $_}).List)
> 
> Sort works by using `cmp` semantics by default.
> 
> If `cmp` is called on two lists, it will `cmp` each element and return the 
> result of the first comparison that did not produce `Same`.
> 
> If you call `sort` with a Callable that takes only one argument, it is taken 
> as the producer of the actual values that will be compared, basically doing a 
> Schwartzian transform under the hood.
> 
> A whatever code (which is what we specified here) produces a Callable with a 
> single argument.  So we'll be doing a Schwartzian transform under the hood.
> 
> The `split` splits the value (each element in the list) on any set of Numeric 
> characters (`\d+`), *but* also produces the strings that were split on 
> (`:v`). (The previous version had .kv, but that just produces more identical 
> entries in the list, which only will make comparisons slower).
> 
> The resulting values from the `split` are then mapped to an integer value (if 
> possible: `(try .Int)` and if that fails, just returns the value (`// $_`).  
> (The previous version had `.Numeric`, which will also work, but since `\d+` 
> can only produce integers, it's an extra unnecessary step).
> 
> Then convert the `.Seq` that is produced by the `.map` to a `List`.  
> Otherwise we'd be comparing `Seq` objects, and the semantics of those are 
> undefined.
> 
> So for `"afoo12" cmp "afoo2"`, we will be doing `("afoo", 12) cmp ("afoo", 
> 2)`.  Which would do: `"afoo" cmp "afoo"`, which produces `Same`, and then do 
> `12 cmp 2`, which will return `More`, and thus will cause swapping the order 
> of .
> 
> 
> Hope that made sense!



Re: pint: Elizabeth, sort list???

2024-03-05 Thread Marc Chantreux
Hi rakoons,

On Sun, Mar 03, 2024 at 01:22:45PM +0100, Elizabeth Mattijsen wrote:
> Actually, the expression can be refined a bit:
>
> say .sort(*.split(/\d+/, :v).map({ (try .Int) // $_}).List)

Which is gorgeous! thanks for that. I read the documentation which is
clear about all the magic in action there. So I played a little with it
and came with this sort

.say for <
afoo12 afoo2 abar12
abar9foo
abar64foo
abar64bang
abar64bang4foo
abar64bang4bar
abar64bang5bar
abar64foo
abar64foo4foo
abar64foo4bar
abar64foo14bar
abar64foo5bar
afoo13 afoo4
>.sort: { | map { +$_ // $_ }, .split: /\d+/, :v }

The ouput seems to be ok.

regards,
-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79



Re: I need sorting help

2024-03-04 Thread ToddAndMargo via perl6-users

On 3/4/24 23:01, ToddAndMargo via perl6-users wrote:
No I have 


Sould have been
   Now I have




Re: I need sorting help

2024-03-04 Thread ToddAndMargo via perl6-users

On 3/4/24 22:09, Bruce Gray wrote:




On Mar 4, 2024, at 15:55, ToddAndMargo via perl6-users  
wrote:



--snip--


$ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try 
.Numeric) // $_}).List)'
bk1
bk2
bk10
bk34

Yippee!


tony@rn6:/home/linuxutil1$ raku -e '.say for .sort: { 
.comb(/ \d+ | \D+ /) .map({ .Int // .self })};'
bk1
bk10
bk2
bk34

Rats!  Thank for trying anyway!

--
love, todd



Wow! Very subtle trap with Seq!

The short answer is: Just add `.cache`:
raku -e '.say for .sort: { .comb(/ \d+ | \D+ /).map({ .Int 
// .self }).cache };'
bk1
bk2
bk10
bk34

When the elements that `.sort` is sorting are of type List or Array, the 
sorting happens one slot at a time; the sort happens on element [0] of each 
List, and ties are settled by [1] (or [2] if [1] are also a tie, etc). This 
enables `.sort` to behave very intuitively (after the shock wears off).

I did not detect the problem by eye, but when I broke it down on the 
commandline I see that Seq objects are being created by `.comb` and `.map`.
Objects of Seq type can only be read *once*, so the multiple reads that `.sort` 
needs would not play well with Seq. It does not matter whether you convert the 
numbers to a Numeric type (which you did correctly in the `.map`), they are 
still part of a Seq.

The .cache method turns the Seq into a List, and the sort behaves as you 
intended.
https://docs.raku.org/routine/cache


Awesome!  No I have two different methods!

-T



Re: I need sorting help

2024-03-04 Thread Bruce Gray



> On Mar 4, 2024, at 15:55, ToddAndMargo via perl6-users  
> wrote:


--snip--

> $ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try 
> .Numeric) // $_}).List)'
> bk1
> bk2
> bk10
> bk34
> 
> Yippee!
> 
> 
> tony@rn6:/home/linuxutil1$ raku -e '.say for .sort: { 
> .comb(/ \d+ | \D+ /) .map({ .Int // .self })};'
> bk1
> bk10
> bk2
> bk34
> 
> Rats!  Thank for trying anyway!
> 
> -- 
> love, todd


Wow! Very subtle trap with Seq!

The short answer is: Just add `.cache`:
raku -e '.say for .sort: { .comb(/ \d+ | \D+ /).map({ .Int 
// .self }).cache };' 
bk1
bk2
bk10
bk34

When the elements that `.sort` is sorting are of type List or Array, the 
sorting happens one slot at a time; the sort happens on element [0] of each 
List, and ties are settled by [1] (or [2] if [1] are also a tie, etc). This 
enables `.sort` to behave very intuitively (after the shock wears off).

I did not detect the problem by eye, but when I broke it down on the 
commandline I see that Seq objects are being created by `.comb` and `.map`.
Objects of Seq type can only be read *once*, so the multiple reads that `.sort` 
needs would not play well with Seq. It does not matter whether you convert the 
numbers to a Numeric type (which you did correctly in the `.map`), they are 
still part of a Seq.

The .cache method turns the Seq into a List, and the sort behaves as you 
intended.
https://docs.raku.org/routine/cache


-- 
Hope this helps,
Bruce Gray (Util of PerlMonks)



Re: I need sorting help

2024-03-04 Thread ToddAndMargo via perl6-users

On 3/4/24 13:55, ToddAndMargo via perl6-users wrote:

On 3/4/24 12:40, Ralph Mellor wrote:

On Sat, Mar 2, 2024 at 6:26 AM ToddAndMargo via perl6-users
 wrote:


@Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int 
// .self })};


In case another answer is helpful...

First, a simplified sort that produces the same
result as your code above:

@Sorted_List .= sort: *.match: / \d+ /;

I can explain that in a later comment if you want, but it's
all stuff I recall you figuring out in the past, so for now I'll
just move on to address the change you wanted.

The problem you had was that sort defaults to a string sort.
In string sorting 1, 10, 2 are already sorted, but you instead
want numeric order, which sorts those three into 1, 2, 10.

To do that, coerce the sort value to numeric by inserting a `+`:

@Sorted_List .= sort: +*.match: / \d+ /;

--
love, raiph



$ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ 
(try .Numeric) // $_}).List)'

bk1
bk2
bk10
bk34

Yippee!


tony@rn6:/home/linuxutil1$ raku -e '.say for .sort: { 
.comb(/ \d+ | \D+ /) .map({ .Int // .self })};'

bk1
bk10
bk2
bk34

Rats!  Thank for trying anyway!




$ raku -e '.say for .sort: { .comb(/ \d+ | \D+ /) 
.map({ .Str // .self })};'

bk1
bk10
bk2
bk34


Double Rats!


Re: I need sorting help

2024-03-04 Thread ToddAndMargo via perl6-users

On 3/4/24 12:40, Ralph Mellor wrote:

On Sat, Mar 2, 2024 at 6:26 AM ToddAndMargo via perl6-users
 wrote:


@Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self 
})};


In case another answer is helpful...

First, a simplified sort that produces the same
result as your code above:

@Sorted_List .= sort: *.match: / \d+ /;

I can explain that in a later comment if you want, but it's
all stuff I recall you figuring out in the past, so for now I'll
just move on to address the change you wanted.

The problem you had was that sort defaults to a string sort.
In string sorting 1, 10, 2 are already sorted, but you instead
want numeric order, which sorts those three into 1, 2, 10.

To do that, coerce the sort value to numeric by inserting a `+`:

@Sorted_List .= sort: +*.match: / \d+ /;

--
love, raiph



$ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ 
(try .Numeric) // $_}).List)'

bk1
bk2
bk10
bk34

Yippee!


tony@rn6:/home/linuxutil1$ raku -e '.say for .sort: { 
.comb(/ \d+ | \D+ /) .map({ .Int // .self })};'

bk1
bk10
bk2
bk34

Rats!  Thank for trying anyway!

--
love, todd


Re: I need sorting help

2024-03-04 Thread Ralph Mellor
> @Sorted_List .= sort: *.match: / \d+ /;
> ...
> @Sorted_List .= sort: +*.match: / \d+ /;

Or perhaps easier to understand:

@Sorted_List .= sort: {m/ \d+ /.Str}
vs
@Sorted_List .= sort: {m/ \d+ /.Int}

love, raiph


Re: I need sorting help

2024-03-04 Thread Ralph Mellor
On Sat, Mar 2, 2024 at 6:26 AM ToddAndMargo via perl6-users
 wrote:
>
> @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self 
> })};

In case another answer is helpful...

First, a simplified sort that produces the same
result as your code above:

@Sorted_List .= sort: *.match: / \d+ /;

I can explain that in a later comment if you want, but it's
all stuff I recall you figuring out in the past, so for now I'll
just move on to address the change you wanted.

The problem you had was that sort defaults to a string sort.
In string sorting 1, 10, 2 are already sorted, but you instead
want numeric order, which sorts those three into 1, 2, 10.

To do that, coerce the sort value to numeric by inserting a `+`:

@Sorted_List .= sort: +*.match: / \d+ /;

--
love, raiph


Re: missing block

2024-03-03 Thread ToddAndMargo via perl6-users

On 3/3/24 04:25, Elizabeth Mattijsen wrote:

On 3 Mar 2024, at 05:12, ToddAndMargo via perl6-users  
wrote:
$ raku -I./ -c CobianWrapper.pl6
Missing block
at /home/CDs/Windows/NtUtil/CobianWrapper.pl6:1000

1000 is the last line in my code.  I presume by
"block" they mean something like "]" or "}"

Do I really have to read 1000 lines of code to find my screw
up?   Anyone have a tip on how to find it quicker?


I use `vim` as the editor.

In `vim` if I have this situation, then I put the cursor on the first opening { 
 and press `%`.  This brings me to the corresponding closing }.

If the associated closing curly does not match your expectations, then you're 
nearing the source of the problem.

I assume other code editor have a similar `%` functionality.


Hi Elizabeth,

I learned vi about 35 years ago.  I still use
it occasionally.  I will have to try out that
% feature out.  Thank you!   (I just made
a quick "Keeper" out of it.)

I use Geany for programming a lot.  Primarily
as is works well with ssh X11 over poor internet
connections.

Geany has a thing were you park on a bracket of
some type and it will turn the other end blue.
So, something similar to vi (an alias to vim).

To work around the missing block issue, I always
place both sides of a {} before writing inside
them.  It does not always work if I ramble too much.

And it is the tip off that I have rambled on too
much and need to put some things into subs.
Considering I am a YUGE proponent of "top down"
programming, I really should know better.

This is what became of your help:

sub SortList( @List, Str $Msg, Bool $NoDebug )  {
   my @Sorted = Empty;
   @Sorted = @List.sort(*.split(/\d+/, :kv).map({ (try .Numeric) // 
$_}).List);


   if  %Options< Debug >  && not $NoDebug  {
  print "$Msg";
  for @Sorted.kv -> $Index, $Element  {
  print "   Element [$Index]  <$Element>\n";
  }
   }
   return @Sorted;
}


sub ListParentDir( Str $Msg, Bool $NoDebug = False  )  {
   # list and sort %Options
   my @List = Empty;
   for dir( %Options ) { push @List, $_.Str };
   @List = SortList @List, $Msg, $NoDebug;
   return @List;
}


It really cut down on the clutter and made missing
bracket much easier to find.

Oh and you helped me fix a bug in my program that I
had though was a Windows error that had been going
on for years.  Thank you again!

-T





Re: pint: Elizabeth, sort list???

2024-03-03 Thread Elizabeth Mattijsen
> On 3 Mar 2024, at 03:32, ToddAndMargo via perl6-users  
> wrote:
> 
>> On 3/2/24 05:13, Elizabeth Mattijsen wrote:
>>> .sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List)
> 
>> Hi Elizabeth,
>> It works perfectly.  Thank you!
>> I have no idea why, I will ask you in another post
> Would you take apart your sort piece by piece and explain
> each part?

Actually, the expression can be refined a bit:

say .sort(*.split(/\d+/, :v).map({ (try .Int) // $_}).List)

Sort works by using `cmp` semantics by default.

If `cmp` is called on two lists, it will `cmp` each element and return the 
result of the first comparison that did not produce `Same`.

If you call `sort` with a Callable that takes only one argument, it is taken as 
the producer of the actual values that will be compared, basically doing a 
Schwartzian transform under the hood.

A whatever code (which is what we specified here) produces a Callable with a 
single argument.  So we'll be doing a Schwartzian transform under the hood.

The `split` splits the value (each element in the list) on any set of Numeric 
characters (`\d+`), *but* also produces the strings that were split on (`:v`). 
(The previous version had .kv, but that just produces more identical entries in 
the list, which only will make comparisons slower).

The resulting values from the `split` are then mapped to an integer value (if 
possible: `(try .Int)` and if that fails, just returns the value (`// $_`).  
(The previous version had `.Numeric`, which will also work, but since `\d+` can 
only produce integers, it's an extra unnecessary step).

Then convert the `.Seq` that is produced by the `.map` to a `List`.  Otherwise 
we'd be comparing `Seq` objects, and the semantics of those are undefined.

So for `"afoo12" cmp "afoo2"`, we will be doing `("afoo", 12) cmp ("afoo", 2)`. 
 Which would do: `"afoo" cmp "afoo"`, which produces `Same`, and then do `12 
cmp 2`, which will return `More`, and thus will cause swapping the order of 
.


Hope that made sense!

Re: missing block

2024-03-02 Thread ToddAndMargo via perl6-users

On 3/2/24 20:12, ToddAndMargo via perl6-users wrote:

Hi All,

$ raku -I./ -c CobianWrapper.pl6
Missing block
at /home/CDs/Windows/NtUtil/CobianWrapper.pl6:1000

1000 is the last line in my code.  I presume by
"block" they mean something like "]" or "}"

Do I really have to read 1000 lines of code to find my screw
up?   Anyone have a tip on how to find it quicker?

Many thanks,
-T


Found it.  It was a missing "}"

I did it by erasing the innards of the suspected directory
(after making a copy of it of cource), then running -c.
Syntax came back okay.

Then it was a meter of doing he same to blocks inside
the directory until I finally narrowed it down.

Geez!!!

-T



missing block

2024-03-02 Thread ToddAndMargo via perl6-users

Hi All,

$ raku -I./ -c CobianWrapper.pl6
Missing block
at /home/CDs/Windows/NtUtil/CobianWrapper.pl6:1000

1000 is the last line in my code.  I presume by
"block" they mean something like "]" or "}"

Do I really have to read 1000 lines of code to find my screw
up?   Anyone have a tip on how to find it quicker?

Many thanks,
-T


--

Yesterday it worked.
Today it is not working.
Windows is like that.



Re: pint: Elizabeth, sort list???

2024-03-02 Thread ToddAndMargo via perl6-users

On 3/2/24 19:14, Clifton Wood wrote:

.sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List)


Can you take apart the above for me?


Re: ping: Elizabeth, sort list???

2024-03-02 Thread ToddAndMargo via perl6-users

Sorry, that was suppose to be "ping: not "pint:


Re: pint: Elizabeth, sort list???

2024-03-02 Thread Clifton Wood
https://gist.github.com/Xliff/286f1359e40d192d724ed9b900354015

On Sat, Mar 2, 2024 at 9:32 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> > On 3/2/24 05:13, Elizabeth Mattijsen wrote:
> >> .sort(*.split(/\d+/, :kv).map({ (try .Numeric) //
> $_}).List)
>
> > Hi Elizabeth,
> >
> >  It works perfectly.  Thank you!
> >
> >  I have no idea why, I will ask you in another post
>
> Hi Elizabeth,
>
> Would you take apart your sort piece by piece and explain
> each part?
>
> Many thanks,
> -T
>
>
>


Re: I need sorting help

2024-03-02 Thread Clifton Wood
Easy multisort!

my @h = (

{

name => "albert",
age => 40,
size => 2

},
{

},
{

);

#
({age => 40, name => albert, size => 2} {age => 69, name => albert, size =>
3} {age => 22, name => andy, size => 3})


On Sat, Mar 2, 2024 at 9:29 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 3/2/24 05:13, Elizabeth Mattijsen wrote:
> > .sort(*.split(/\d+/, :kv).map({ (try .Numeric) //
> $_}).List)
>
> Hi Elizabeth,
>
>   It works perfectly.  Thank you!
>
>   I have no idea why, I will ask you in another post
>
> -T
>


pint: Elizabeth, sort list???

2024-03-02 Thread ToddAndMargo via perl6-users

On 3/2/24 05:13, Elizabeth Mattijsen wrote:

.sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List)



Hi Elizabeth,

 It works perfectly.  Thank you!

 I have no idea why, I will ask you in another post


Hi Elizabeth,

Would you take apart your sort piece by piece and explain
each part?

Many thanks,
-T




Re: I need sorting help

2024-03-02 Thread ToddAndMargo via perl6-users

On 3/2/24 05:13, Elizabeth Mattijsen wrote:

.sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List)


Hi Elizabeth,

 It works perfectly.  Thank you!

 I have no idea why, I will ask you in another post

-T


RE: I need sorting help

2024-03-02 Thread Mark Devine
Elizabeth,

I have been looking for that one to sort operating system devices.  Exceptional 
timing!

Thanks,

Mark Devine
(202) 878-1500

-Original Message-
From: Elizabeth Mattijsen  
Sent: Saturday, March 2, 2024 8:14 AM
To: ToddAndMargo via perl6-users 
Subject: Re: I need sorting help

$ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try 
.Numeric) // $_}).List)
afoo2
afoo12


> On 2 Mar 2024, at 07:26, ToddAndMargo via perl6-users  
> wrote:
> 
> Hi All,
> 
> @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self 
> })};
> 
> gives me
> 
>   Element [0]  
>   Element [1]  
>   Element [2]  
>   Element [3]  
>   Element [4]  
>   Element [5]  
>   Element [6]  
>   Element [7]  
>   Element [8]  
>   Element [9]  
> 
> I need it to say
> 
>   Element [0]  
>   Element [1]  
>   Element [2]  
>   Element [3]  
>   Element [4]  
>   Element [5]  
>   Element [6]  
>   Element [7]  
>   Element [8]  
>   Element [9]  
> 
> What did I goof up, this time?
> 
> Many thanks,
> -T



Re: I need sorting help

2024-03-02 Thread Elizabeth Mattijsen
$ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try 
.Numeric) // $_}).List)
afoo2
afoo12


> On 2 Mar 2024, at 07:26, ToddAndMargo via perl6-users  
> wrote:
> 
> Hi All,
> 
> @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self 
> })};
> 
> gives me
> 
>   Element [0]  
>   Element [1]  
>   Element [2]  
>   Element [3]  
>   Element [4]  
>   Element [5]  
>   Element [6]  
>   Element [7]  
>   Element [8]  
>   Element [9]  
> 
> I need it to say
> 
>   Element [0]  
>   Element [1]  
>   Element [2]  
>   Element [3]  
>   Element [4]  
>   Element [5]  
>   Element [6]  
>   Element [7]  
>   Element [8]  
>   Element [9]  
> 
> What did I goof up, this time?
> 
> Many thanks,
> -T



I need sorting help

2024-03-01 Thread ToddAndMargo via perl6-users

Hi All,

@Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // 
.self })};


gives me

   Element [0]  
   Element [1]  
   Element [2]  
   Element [3]  
   Element [4]  
   Element [5]  
   Element [6]  
   Element [7]  
   Element [8]  
   Element [9]  

I need it to say

   Element [0]  
   Element [1]  
   Element [2]  
   Element [3]  
   Element [4]  
   Element [5]  
   Element [6]  
   Element [7]  
   Element [8]  
   Element [9]  

What did I goof up, this time?

Many thanks,
-T


Re: disable coercing?

2024-02-26 Thread ToddAndMargo via perl6-users

On 2/25/24 17:45, Joseph Brenner wrote:

Would this trick help?  You can define a "subset" that restricts
values to the uint16 range:

  my subset FussyUint16 of Int where 0 ..^ 2¹⁶;
  my FussyUint16 $x;
  $x = -1;
  ## Type check failed in assignment to $x; expected FussyUint16
but got Int (-1)


I got around it by cleaning up my act.  It was
really my fault for not respecting what Raku
was trying to do.  Since I endeavor to define
all my variables, I should have known better.


Re: disable coercing?

2024-02-25 Thread Joseph Brenner
Would this trick help?  You can define a "subset" that restricts
values to the uint16 range:

 my subset FussyUint16 of Int where 0 ..^ 2¹⁶;
 my FussyUint16 $x;
 $x = -1;
 ## Type check failed in assignment to $x; expected FussyUint16
but got Int (-1)


The SF Perl Raku Study Group, 02/25 at 1pm PDT

2024-02-23 Thread Joseph Brenner
   "Over the years, executives have backed their desire to
   eliminate programmers with staggering funds.  Dozens of
   simplistic schemes have been heaped with money and praise
   on the promise-- as yet not kept-- of going directly from
   sales proposal to a working data-processing system. But we
   should not chide these executives for their naiveté in
   assessing technical merits.  We should applaud them in
   their sophistication in sensing the source of so many of
   our problems.  Their touching faith in the magic of
   technology should serve as inspiration ... "

  Gerald M. Weinberg,
  "Psychology of Computer Programming" (1971)

The Raku Study Group

February 25, 2024  1pm in California, 9pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
  https://us02web.zoom.us/j/86800235484?pwd=UXByayt0cStZM1BUY1IzS21sY2IzQT09

Passcode: 4RakuRoll

RSVPs are useful, though not needed:
  https://www.meetup.com/san-francisco-perl/events/299388335/


Re: pm6 naming convention

2024-02-12 Thread ToddAndMargo via perl6-users

On 2/12/24 15:04, Will Coleda wrote:



On Mon, Feb 12, 2024 at 5:32 PM ToddAndMargo via perl6-users 
mailto:perl6-users@perl.org>> wrote:


On 2/12/24 14:29, ToddAndMargo via perl6-users wrote:
 >>> On Mon, Feb 12, 2024 at 3:24 PM ToddAndMargo via perl6-users
 >>> mailto:perl6-users@perl.org>
>> wrote:
 >>
 >>>     Has .pl6 been renamed too?
 >
 > On 2/12/24 12:37, Will Coleda wrote:
 >  > Please see: https://docs.raku.org/language/filename-extensions

 >  > >
 >  >
 >
 > Thank you!  I saved it in my own documentation.

Interesting that the site calls Raku code a
"script".  I wonder just exactly how many
thousands of lines of code I have to write before
I can officially call it a "program"?


Pull requests welcome, and if you have any specific notes about searches 
that aren't working for you, please report them on 
https://github.com/Raku/doc/issues .


You can click on the edit icon on that doc page to easily submit a PR.



Hi Will,

Richard wrote me off line that the search had been updated
too, so I gave it the search I bombed out a month or so ago:

https://www.google.com/search?q=site%3Adocs.raku.org+unit32

Forth one down.

int8(int8_t in C)
int16   (int16_t in C)
int32   (int32_t in C)
int64   (int64_t in C)
byte, uint8 (uint8_t in C)
uint16  (uint16_t in C)
uint32  (uint32_t in C)
uint64  (uint64_t in C)
num32   (float in C)
num64   (double in C)

Yippee!

Now to figure out why I was bombing on int32 (DWORD)
[2] > my uint32 $x = 2
2
[3] > my int32 $y = $x.int32

No such method 'int32' for invocant of type 'Int'.  Did you mean 'Int'?
  in block  at  line 1
  in any  at 
/opt/rakudo-pkg/bin/../share/perl6/runtime/perl6.moarvm line 1
  in any  at 
/opt/rakudo-pkg/bin/../share/perl6/runtime/perl6.moarvm line 1



But this works:

[4] > my int32 $y = $x.Int
2

H.

-T


Re: pm6 naming convention

2024-02-12 Thread ToddAndMargo via perl6-users

On 2/12/24 15:04, Will Coleda wrote:
Pull requests welcome, and if you have any specific notes about searches 
that aren't working for you, please report them on 
https://github.com/Raku/doc/issues .


You can click on the edit icon on that doc page to easily submit a PR.


I will check it out!  Thank you!


Re: pm6 naming convention

2024-02-12 Thread Will Coleda
On Mon, Feb 12, 2024 at 5:32 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 2/12/24 14:29, ToddAndMargo via perl6-users wrote:
> >>> On Mon, Feb 12, 2024 at 3:24 PM ToddAndMargo via perl6-users
> >>> mailto:perl6-users@perl.org>> wrote:
> >>
> >>> Has .pl6 been renamed too?
> >
> > On 2/12/24 12:37, Will Coleda wrote:
> >  > Please see: https://docs.raku.org/language/filename-extensions
> >  > 
> >  >
> >
> > Thank you!  I saved it in my own documentation.
>
> Interesting that the site calls Raku code a
> "script".  I wonder just exactly how many
> thousands of lines of code I have to write before
> I can officially call it a "program"?
>
>
Pull requests welcome, and if you have any specific notes about searches
that aren't working for you, please report them on
https://github.com/Raku/doc/issues.

You can click on the edit icon on that doc page to easily submit a PR.


Re: pm6 naming convention

2024-02-12 Thread ToddAndMargo via perl6-users

On 2/12/24 14:29, ToddAndMargo via perl6-users wrote:
On Mon, Feb 12, 2024 at 3:24 PM ToddAndMargo via perl6-users 
mailto:perl6-users@perl.org>> wrote:



    Has .pl6 been renamed too?


On 2/12/24 12:37, Will Coleda wrote:
 > Please see: https://docs.raku.org/language/filename-extensions
 > 
 >

Thank you!  I saved it in my own documentation.


Interesting that the site calls Raku code a
"script".  I wonder just exactly how many
thousands of lines of code I have to write before
I can officially call it a "program"?



Re: pm6 naming convention

2024-02-12 Thread ToddAndMargo via perl6-users
On Mon, Feb 12, 2024 at 3:24 PM ToddAndMargo via perl6-users 
mailto:perl6-users@perl.org>> wrote:



Has .pl6 been renamed too?


On 2/12/24 12:37, Will Coleda wrote:
> Please see: https://docs.raku.org/language/filename-extensions
> 
>

Thank you!  I saved it in my own documentation.

I can't find a thing anymore since they updated the
documentation site.  I use google a lot and my own
documentation.  Looking up "raku" gets me a ton of hits
on Japanese pottery, so it is frustrating.


Re: pm6 naming convention

2024-02-12 Thread Will Coleda
Please see: https://docs.raku.org/language/filename-extensions

On Mon, Feb 12, 2024 at 3:24 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

>
> >> On 12 Feb 2024, at 20:34, ToddAndMargo via perl6-users <
> perl6-users@perl.org> wrote:
> >>
> >>
>  On 6 Feb 2024, at 18:08, ToddAndMargo via perl6-users <
> perl6-users@perl.org> wrote:
> 
>  Hi All,
> 
>  I use AnyDesk for remoter customer support.  Work rather well.
> 
>  The file transfer portion, which I adore, posts a Microsoft
>  Office Publisher Icon (a big one) when it hits a .pm6 modules.
> 
>  Is there a different naming convention I can use for my
>  modules that does not mimic some other program?
> 
>  Many thanks,
>  -T
> >>
> >> On 2/12/24 11:11, Elizabeth Mattijsen wrote:
> >>> .rakumod
> >>
> >>
> >> Thank you!
> >>
> >> Is there a way to get raku to ignore pm (perl 5)
> >> module naming?
>
> On 2/12/24 11:40, Elizabeth Mattijsen wrote:
>  > It's been marked as DEPRECATED since 2023.12 I believe.
>  >
>
> Cool.
>
> Has .pl6 been renamed too?
>
>


Re: pm6 naming convention

2024-02-12 Thread ToddAndMargo via perl6-users




On 12 Feb 2024, at 20:34, ToddAndMargo via perl6-users  
wrote:



On 6 Feb 2024, at 18:08, ToddAndMargo via perl6-users  
wrote:

Hi All,

I use AnyDesk for remoter customer support.  Work rather well.

The file transfer portion, which I adore, posts a Microsoft
Office Publisher Icon (a big one) when it hits a .pm6 modules.

Is there a different naming convention I can use for my
modules that does not mimic some other program?

Many thanks,
-T


On 2/12/24 11:11, Elizabeth Mattijsen wrote:

.rakumod



Thank you!

Is there a way to get raku to ignore pm (perl 5)
module naming?


On 2/12/24 11:40, Elizabeth Mattijsen wrote:
> It's been marked as DEPRECATED since 2023.12 I believe.
>

Cool.

Has .pl6 been renamed too?



Re: pm6 naming convention

2024-02-12 Thread Elizabeth Mattijsen
It's been marked as DEPRECATED since 2023.12 I believe.

> On 12 Feb 2024, at 20:34, ToddAndMargo via perl6-users  
> wrote:
> 
> 
>>> On 6 Feb 2024, at 18:08, ToddAndMargo via perl6-users 
>>>  wrote:
>>> 
>>> Hi All,
>>> 
>>> I use AnyDesk for remoter customer support.  Work rather well.
>>> 
>>> The file transfer portion, which I adore, posts a Microsoft
>>> Office Publisher Icon (a big one) when it hits a .pm6 modules.
>>> 
>>> Is there a different naming convention I can use for my
>>> modules that does not mimic some other program?
>>> 
>>> Many thanks,
>>> -T
> 
> On 2/12/24 11:11, Elizabeth Mattijsen wrote:
> > .rakumod
> 
> 
> Thank you!
> 
> Is there a way to get raku to ignore pm (perl 5)
> module naming?
> 



Re: pm6 naming convention

2024-02-12 Thread ToddAndMargo via perl6-users




On 6 Feb 2024, at 18:08, ToddAndMargo via perl6-users  
wrote:

Hi All,

I use AnyDesk for remoter customer support.  Work rather well.

The file transfer portion, which I adore, posts a Microsoft
Office Publisher Icon (a big one) when it hits a .pm6 modules.

Is there a different naming convention I can use for my
modules that does not mimic some other program?

Many thanks,
-T


On 2/12/24 11:11, Elizabeth Mattijsen wrote:
> .rakumod


Thank you!

Is there a way to get raku to ignore pm (perl 5)
module naming?



Re: pm6 naming convention

2024-02-12 Thread Elizabeth Mattijsen
.rakumod

> On 6 Feb 2024, at 18:08, ToddAndMargo via perl6-users  
> wrote:
> 
> Hi All,
> 
> I use AnyDesk for remoter customer support.  Work rather well.
> 
> The file transfer portion, which I adore, posts a Microsoft
> Office Publisher Icon (a big one) when it hits a .pm6 modules.
> 
> Is there a different naming convention I can use for my
> modules that does not mimic some other program?
> 
> Many thanks,
> -T
> 
> -- 
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~



Re: who call raku?

2024-02-10 Thread ToddAndMargo via perl6-users

On 2/10/24 16:01, ToddAndMargo via perl6-users wrote:

On 2/10/24 15:26, Marc Chantreux wrote:
On Thu, Feb 08, 2024 at 02:25:00PM -0800, ToddAndMargo via perl6-users 
wrote:

Actually, I am looking for the name of the calling program:
Cobian, Task manager, deamon, etc..


linux centric anwser:

raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'

hth




$ raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'
bash


Very cool.  Thank you.

I also need (only a little bit, I figured a way
around it) to kow how to do it in Windows.




Winsdows no so cool.  perl -e does not get past the
quoting issue from the command console.

So:

>raku

[0] > say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]
Failed to open file K:\proc\6640\stat: No such file or directory
  in method throw at 'SETTING::'src/core.c/Exception.rakumod line 65
  in method fail at 'SETTING::'src/core.c/Exception.rakumod line 89
  in block  at 'SETTING::'src/core.c/IO/Handle.rakumod line 158
  in method open at 'SETTING::'src/core.c/IO/Handle.rakumod line 155
  in method open at 'SETTING::'src/core.c/IO/Path.rakumod line 212
  in method words at 'SETTING::'src/core.c/IO/Path.rakumod line 805
  in block  at  line 1



Re: who call raku?

2024-02-10 Thread ToddAndMargo via perl6-users

On 2/10/24 15:26, Marc Chantreux wrote:

On Thu, Feb 08, 2024 at 02:25:00PM -0800, ToddAndMargo via perl6-users wrote:

Actually, I am looking for the name of the calling program:
Cobian, Task manager, deamon, etc..


linux centric anwser:

raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'

hth




$ raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'
bash


Very cool.  Thank you.

I also need (only a little bit, I figured a way
around it) to kow how to do it in Windows.


Re: who call raku?

2024-02-10 Thread Marc Chantreux
On Thu, Feb 08, 2024 at 02:25:00PM -0800, ToddAndMargo via perl6-users wrote:
> Actually, I am looking for the name of the calling program:
> Cobian, Task manager, deamon, etc..

linux centric anwser:

raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'

hth

-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79



Re: disable coercing?

2024-02-10 Thread ToddAndMargo via perl6-users

On 2/10/24 02:41, Elizabeth Mattijsen wrote:

On 10 Feb 2024, at 08:56, ToddAndMargo via perl6-users  
wrote:

Hi All,

Is there a switch to tell Raku to bomb out with a
type mismatch rather than coercing the following?


my uint16 $x = -1

65535


No, this is intentional behaviour on native integers.


Rats.

I type cast my variable when I can to keep me out of trouble
("Expected Int but got Str").  Guess I got a bit too
lazy.   I am going to have to be more careful when
dealing with Cardinals (unit's).  I did get stung by this
yesterday. Took me hours to figure it out.


Note that you can increment such a value without problems:

[0] > my uint16 $x = -1;
65535
[1] > ++$x
0


Oh now that is really sneaky and speaks
of any underlying understand of bit wise
operations!  :-)

Thank you!




Re: disable coercing?

2024-02-10 Thread Elizabeth Mattijsen
> On 10 Feb 2024, at 08:56, ToddAndMargo via perl6-users  
> wrote:
> 
> Hi All,
> 
> Is there a switch to tell Raku to bomb out with a
> type mismatch rather than coercing the following?
> 
> > my uint16 $x = -1
> 65535

No, this is intentional behaviour on native integers.

Note that you can increment such a value without problems:

[0] > my uint16 $x = -1;
65535
[1] > ++$x
0

disable coercing?

2024-02-09 Thread ToddAndMargo via perl6-users

Hi All,

Is there a switch to tell Raku to bomb out with a
type mismatch rather than coercing the following?

> my uint16 $x = -1
65535


Many thanks,
-T


--

If I had a dime every time I didn't know
what was going on, I'd be like, "Why is
everyone giving me all these dimes?"



Re: who call raku?

2024-02-08 Thread ToddAndMargo via perl6-users

On 2/8/24 14:25, ToddAndMargo via perl6-users wrote:

On 2/8/24 13:19, Bruce Gray wrote:



On Feb 8, 2024, at 15:12, ToddAndMargo via perl6-users 
 wrote:


Hi All,

Is there one of those fancy system variables that will
tell me who called/started raku?


Ooops.  I should have said "what called" not "who called".


raku -e 'say $*USER'
bruce




Actually, I am looking for the name of the calling program:
Cobian, Task manager, deamon, etc..


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



Re: Session ID

2024-02-08 Thread ToddAndMargo via perl6-users

On 2/6/24 17:50, ToddAndMargo via perl6-users wrote:

Hi All

Windows 10 and 11

Does Raku have a system call that will tell
me my "session ID"?

Many thanks,
-T



So far what I have come up with is a system call to "wmic":

>raku -e "sleep 14"

>wmic process where "name='raku.exe'" get ProcessID,SessionID,CommandLine
CommandLine  ProcessId  SessionId
raku  -e "sleep 14"  5020   1


Re: who call raku?

2024-02-08 Thread ToddAndMargo via perl6-users

On 2/8/24 13:19, Bruce Gray wrote:




On Feb 8, 2024, at 15:12, ToddAndMargo via perl6-users  
wrote:

Hi All,

Is there one of those fancy system variables that will
tell me who called/started raku?


raku -e 'say $*USER'
bruce




Actually, I am looking for the name of the calling program:
Cobian, Task manager, deamon, etc..


Re: who call raku?

2024-02-08 Thread Bruce Gray



> On Feb 8, 2024, at 15:12, ToddAndMargo via perl6-users  
> wrote:
> 
> Hi All,
> 
> Is there one of those fancy system variables that will
> tell me who called/started raku?

raku -e 'say $*USER'
bruce

-- 
Hope this helps,
Bruce Gray (Util of Perlmonks)



who call raku?

2024-02-08 Thread ToddAndMargo via perl6-users

Hi All,

Is there one of those fancy system variables that will
tell me who called/started raku?


Many thanks,
-T

--
~~~
Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank.
~~~


Session ID

2024-02-06 Thread ToddAndMargo via perl6-users

Hi All

Windows 10 and 11

Does Raku have a system call that will tell
me my "session ID"?

Many thanks,
-T

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


Re: -c question

2024-02-06 Thread ToddAndMargo via perl6-users

On 2/6/24 09:03, Bruce Gray wrote:




On Feb 6, 2024, at 10:52, ToddAndMargo via perl6-users  
wrote:


On 6 Feb 2024, at 00:39, ToddAndMargo via perl6-users  
wrote:

Hi All,

Is there a way to syntax a module?  Sort of like the "-c"
option on main programs?

Many thanks,
-T


On 2/6/24 01:34, Elizabeth Mattijsen wrote:

$ raku -c foo.rakumod
Syntax OK



$ raku -c WinMessageBox.pm6
===SORRY!=== Error while compiling /home/CDs/Windows/NtUtil/WinMessageBox.pm6
Could not find NativeConvert in:
/home/tony/.raku
/opt/rakudo-pkg/share/perl6/site
/opt/rakudo-pkg/share/perl6/vendor
/opt/rakudo-pkg/share/perl6/core
CompUnit::Repository::AbsolutePath<4639587332824>
CompUnit::Repository::NQP<4639586267208>
CompUnit::Repository::Perl5<4639586267248>
at /home/CDs/Windows/NtUtil/WinMessageBox.pm6:50

$ which NativeConvert.pm6
./NativeConvert.pm6
and three other pm.6's WinMessageBox imports.

I can only compile check my modules if I
import them to a program and -c the program.

For example, the following program uses
the above module:
$ raku -c CobianWrapper.pl6
Syntax OK

I just want to do a syntax check on my modules
at time without the program.

:'(


The wrapper program can be a `-e` one-liner, like:
 raku -c -e 'use NativeCall;'
 Syntax OK
 
Does this work for you?

 raku -c -e 'use WinMessageBox;'
 


Rats!

$ raku -c -e 'use WinMessageBox;'
===SORRY!=== Error while compiling -e
Could not find WinMessageBox in:
/home/tony/.raku
/opt/rakudo-pkg/share/perl6/site
/opt/rakudo-pkg/share/perl6/vendor
/opt/rakudo-pkg/share/perl6/core
CompUnit::Repository::AbsolutePath<2965876076768>
CompUnit::Repository::NQP<2965910068576>
CompUnit::Repository::Perl5<2965910068616>
at -e:1

$ raku -I./ -c WinMessageBox.pm6
Syntax OK


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



pm6 naming convention

2024-02-06 Thread ToddAndMargo via perl6-users

Hi All,

I use AnyDesk for remoter customer support.  Work rather well.

The file transfer portion, which I adore, posts a Microsoft
Office Publisher Icon (a big one) when it hits a .pm6 modules.

Is there a different naming convention I can use for my
modules that does not mimic some other program?

Many thanks,
-T

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


Re: -c question

2024-02-06 Thread ToddAndMargo via perl6-users




On 6 Feb 2024, at 17:52, ToddAndMargo via perl6-users  
wrote:


On 6 Feb 2024, at 00:39, ToddAndMargo via perl6-users  
wrote:

Hi All,

Is there a way to syntax a module?  Sort of like the "-c"
option on main programs?

Many thanks,
-T


On 2/6/24 01:34, Elizabeth Mattijsen wrote:

$ raku -c foo.rakumod
Syntax OK



$ raku -c WinMessageBox.pm6
===SORRY!=== Error while compiling /home/CDs/Windows/NtUtil/WinMessageBox.pm6
Could not find NativeConvert in:
/home/tony/.raku
/opt/rakudo-pkg/share/perl6/site
/opt/rakudo-pkg/share/perl6/vendor
/opt/rakudo-pkg/share/perl6/core
CompUnit::Repository::AbsolutePath<4639587332824>
CompUnit::Repository::NQP<4639586267208>
CompUnit::Repository::Perl5<4639586267248>
at /home/CDs/Windows/NtUtil/WinMessageBox.pm6:50

$ which NativeConvert.pm6
./NativeConvert.pm6
and three other pm.6's WinMessageBox imports.

I can only compile check my modules if I
import them to a program and -c the program.

For example, the following program uses
the above module:
$ raku -c CobianWrapper.pl6
Syntax OK

I just want to do a syntax check on my modules
at time without the program.

:'(


On 2/6/24 08:57, Elizabeth Mattijsen wrote:
> Do you have some "use lib 'foo'" setting in your program?
>
> If so, use that on the command-line, e.g.:
>
>  $ raku -Ifoo -c bar.rakumod
>

Indeed I do.  Will the above command check those
modules too, or just verify that they are there?





Re: -c question

2024-02-06 Thread Bruce Gray



> On Feb 6, 2024, at 10:52, ToddAndMargo via perl6-users  
> wrote:
> 
>>> On 6 Feb 2024, at 00:39, ToddAndMargo via perl6-users 
>>>  wrote:
>>> 
>>> Hi All,
>>> 
>>> Is there a way to syntax a module?  Sort of like the "-c"
>>> option on main programs?
>>> 
>>> Many thanks,
>>> -T
> 
> On 2/6/24 01:34, Elizabeth Mattijsen wrote:
> > $ raku -c foo.rakumod
> > Syntax OK
> >
> 
> $ raku -c WinMessageBox.pm6
> ===SORRY!=== Error while compiling /home/CDs/Windows/NtUtil/WinMessageBox.pm6
> Could not find NativeConvert in:
>/home/tony/.raku
>/opt/rakudo-pkg/share/perl6/site
>/opt/rakudo-pkg/share/perl6/vendor
>/opt/rakudo-pkg/share/perl6/core
>CompUnit::Repository::AbsolutePath<4639587332824>
>CompUnit::Repository::NQP<4639586267208>
>CompUnit::Repository::Perl5<4639586267248>
> at /home/CDs/Windows/NtUtil/WinMessageBox.pm6:50
> 
> $ which NativeConvert.pm6
> ./NativeConvert.pm6
> and three other pm.6's WinMessageBox imports.
> 
> I can only compile check my modules if I
> import them to a program and -c the program.
> 
> For example, the following program uses
> the above module:
>$ raku -c CobianWrapper.pl6
>Syntax OK
> 
> I just want to do a syntax check on my modules
> at time without the program.
> 
> :'(

The wrapper program can be a `-e` one-liner, like:
raku -c -e 'use NativeCall;'
Syntax OK

Does this work for you?
raku -c -e 'use WinMessageBox;'

-- 
Hope this helps,
Bruce Gray (Util of PerlMonks)



Re: -c question

2024-02-06 Thread Elizabeth Mattijsen
Do you have some "use lib 'foo'" setting in your program?

If so, use that on the command-line, e.g.:

$ raku -Ifoo -c bar.rakumod

> On 6 Feb 2024, at 17:52, ToddAndMargo via perl6-users  
> wrote:
> 
>>> On 6 Feb 2024, at 00:39, ToddAndMargo via perl6-users 
>>>  wrote:
>>> 
>>> Hi All,
>>> 
>>> Is there a way to syntax a module?  Sort of like the "-c"
>>> option on main programs?
>>> 
>>> Many thanks,
>>> -T
> 
> On 2/6/24 01:34, Elizabeth Mattijsen wrote:
> > $ raku -c foo.rakumod
> > Syntax OK
> >
> 
> $ raku -c WinMessageBox.pm6
> ===SORRY!=== Error while compiling /home/CDs/Windows/NtUtil/WinMessageBox.pm6
> Could not find NativeConvert in:
>/home/tony/.raku
>/opt/rakudo-pkg/share/perl6/site
>/opt/rakudo-pkg/share/perl6/vendor
>/opt/rakudo-pkg/share/perl6/core
>CompUnit::Repository::AbsolutePath<4639587332824>
>CompUnit::Repository::NQP<4639586267208>
>CompUnit::Repository::Perl5<4639586267248>
> at /home/CDs/Windows/NtUtil/WinMessageBox.pm6:50
> 
> $ which NativeConvert.pm6
> ./NativeConvert.pm6
> and three other pm.6's WinMessageBox imports.
> 
> I can only compile check my modules if I
> import them to a program and -c the program.
> 
> For example, the following program uses
> the above module:
>$ raku -c CobianWrapper.pl6
>Syntax OK
> 
> I just want to do a syntax check on my modules
> at time without the program.
> 
> :'(



Re: -c question

2024-02-06 Thread ToddAndMargo via perl6-users

On 6 Feb 2024, at 00:39, ToddAndMargo via perl6-users  
wrote:

Hi All,

Is there a way to syntax a module?  Sort of like the "-c"
option on main programs?

Many thanks,
-T


On 2/6/24 01:34, Elizabeth Mattijsen wrote:
> $ raku -c foo.rakumod
> Syntax OK
>

$ raku -c WinMessageBox.pm6
===SORRY!=== Error while compiling 
/home/CDs/Windows/NtUtil/WinMessageBox.pm6

Could not find NativeConvert in:
/home/tony/.raku
/opt/rakudo-pkg/share/perl6/site
/opt/rakudo-pkg/share/perl6/vendor
/opt/rakudo-pkg/share/perl6/core
CompUnit::Repository::AbsolutePath<4639587332824>
CompUnit::Repository::NQP<4639586267208>
CompUnit::Repository::Perl5<4639586267248>
at /home/CDs/Windows/NtUtil/WinMessageBox.pm6:50

$ which NativeConvert.pm6
./NativeConvert.pm6
and three other pm.6's WinMessageBox imports.

I can only compile check my modules if I
import them to a program and -c the program.

For example, the following program uses
the above module:
$ raku -c CobianWrapper.pl6
Syntax OK

I just want to do a syntax check on my modules
at time without the program.

:'(


Re: -c question

2024-02-06 Thread Elizabeth Mattijsen
$ raku -c foo.rakumod
Syntax OK

> On 6 Feb 2024, at 00:39, ToddAndMargo via perl6-users  
> wrote:
> 
> Hi All,
> 
> Is there a way to syntax a module?  Sort of like the "-c"
> option on main programs?
> 
> Many thanks,
> -T
> 
> 
> 
> -- 
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~



-c question

2024-02-05 Thread ToddAndMargo via perl6-users

Hi All,

Is there a way to syntax a module?  Sort of like the "-c"
option on main programs?

Many thanks,
-T



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


The SF Perl Raku Study Group, 02/04 at 1pm PDT

2024-02-03 Thread Joseph Brenner
John Dewey, "Logic: The Theory of Inquiry" (1938):

"... the more developed this field becomes,
the more pressing is the question as to
what it is all about."

The Raku Study Group

February 4th, 2024  1pm in California, 9pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
  https://us02web.zoom.us/j/87320867624?pwd=UUNjNWx1YUp2RWdPay8zWnFydGcvUT09

Passcode: 4RakuRoll

RSVPs are useful, though not needed:
  https://www.meetup.com/san-francisco-perl/events/298981917/


Re: IO::Socket::INET timeout?

2024-01-21 Thread Paul Procacci
On Sat, Jan 20, 2024 at 5:02 PM William Michels 
wrote:

> Hi Paul,
>
> Did you get any resolution on this? I've only found these links:
>
> https://docs.raku.org/type/IO/Socket/INET
>
>
> https://stackoverflow.com/questions/72639883/how-to-deal-with-exceptions-in-iosocketinet
>
> I imagine a solution is possible using a Supply, but I haven't gotten
> there yet:
>
> https://docs.raku.org/type/Supply
>
> Best, Bill.
>
>
> On Jan 8, 2024, at 18:06, Paul Procacci  wrote:
>
> Hey all,
>
> What's the right way to specify a timeout for an IO::Socket::INET?
>
> What I have:
> $!socket := IO::Socket::INET.new(:host($!server), :port($!port));
>
> What I'd like to do which isn't possible:
> $!socket := IO::Socket::INET.new(:host($!server), :port($!port),
> :timeout($!timeout);
>
> Can your suggestion apply to reads/writes as well?
> To further this, I've reading on Promises and Supply's and have found
> suggestions that only Supply's can capture errors and whatnot, etc.
>
> I'm not sure what to make if anything I've read.  Does anyone have a clear
> example of connecting a socket, and reading/writing to that socket with
> timeouts?
>
> Thanks,
> Paul Procacci
>
>
> --
> __
>
> :(){ :|:& };:
>
>
>
Hey William,

I haven't made any progress.  I have enough things going on that I can
afford to put it aside for a while and then circle back to this in a bit.
If you find out, please let us know!  I too think Supply is the way forward
here.

~Paul
-- 
__

:(){ :|:& };:


Re: IO::Socket::INET timeout?

2024-01-20 Thread William Michels via perl6-users
Hi Paul,

Did you get any resolution on this? I've only found these links:

https://docs.raku.org/type/IO/Socket/INET

https://stackoverflow.com/questions/72639883/how-to-deal-with-exceptions-in-iosocketinet

I imagine a solution is possible using a Supply, but I haven't gotten there yet:

https://docs.raku.org/type/Supply

Best, Bill.


> On Jan 8, 2024, at 18:06, Paul Procacci  wrote:
> 
> Hey all,
> 
> What's the right way to specify a timeout for an IO::Socket::INET?
> 
> What I have:
> $!socket := IO::Socket::INET.new(:host($!server), :port($!port));
> 
> What I'd like to do which isn't possible:
> $!socket := IO::Socket::INET.new(:host($!server), :port($!port), 
> :timeout($!timeout); 
> 
> Can your suggestion apply to reads/writes as well?
> To further this, I've reading on Promises and Supply's and have found 
> suggestions that only Supply's can capture errors and whatnot, etc.
> 
> I'm not sure what to make if anything I've read.  Does anyone have a clear 
> example of connecting a socket, and reading/writing to that socket with 
> timeouts?
> 
> Thanks,
> Paul Procacci
> 
> 
> -- 
> __
> 
> :(){ :|:& };:



  1   2   3   4   5   6   7   8   9   10   >