Re: checking MAIN arguments

2022-04-28 Thread Luca Ferrari
On Wed, Apr 27, 2022 at 7:29 PM yary wrote: > It's like the "where" clause has its own signature-like list of types it will > accept. When the where clause uses the default topic "$_" then that topic has > no constraint, and MAIN can probe if "--dir=something" should be interpreted > as a flag

Re: checking MAIN arguments

2022-04-16 Thread Luca Ferrari
On Fri, Apr 15, 2022 at 4:15 PM yary wrote: > > Here's how I ended up handling input arg validation, with meaningful error > messages, as part of a Perl Weekly Challenge a couple years ago. It looks > almost the same as Luca's original, except mine uses "die" instead of "warn", > which means

Re: checking MAIN arguments

2022-04-12 Thread Luca Ferrari
On Tue, Apr 12, 2022 at 10:15 AM Luca Ferrari wrote: > > Hello all, > given this simple program: > > sub MAIN( Str :$dir where { .so && .IO.d // warn "Specify the > directory [$dir]" } ) { > say $dir; > } > Shame on me: it works if I omit

checking MAIN arguments

2022-04-12 Thread Luca Ferrari
Hello all, given this simple program: sub MAIN( Str :$dir where { .so && .IO.d // warn "Specify the directory [$dir]" } ) { say $dir; } it works as I expect on ancient versions of rakudo, e.g., 202-01, but it fails miserably on current rakudo: % raku ~/tmp/test.p6 --dir=foo Use of

Re: help with map and regexp

2017-09-21 Thread Luca Ferrari
On Tue, Sep 19, 2017 at 2:43 PM, Timo Paulssen wrote: > perl6 -e '.perl.say for "hello, how, are, you".split(",").map: -> $_ > is copy { s:g/a//; s:g/^ \s|\s $/O/; $_ }' > "hello" > "Ohow" > "Ore" > "Oyou" Thanks. Out of cursiosity: what is the diffence

help with map and regexp

2017-09-19 Thread Luca Ferrari
Hi all, I'm trying to understand how to use map correctly to apply several regexps at once, something like: my @fields = $line.split( ',' ).map: { s:g/\'//; s:g/^\"|\"$//; $_ }; while the first regexp works, the second fails with "Cannot modify an immutable Str", but the topic variable should

can't adverb and infix

2017-09-19 Thread Luca Ferrari
Hi all, this will sound trivial, but the following piece of code that in my mind should work does not: $mode = 'csv' if ( ! $mode.defined || %available_modes{ $mode }:!exists ); and the compiler says: You can't adverb :<||> at /home/luca/tmp/am/folken.p6:16 --> ined || %available_modes{

Re: Any text editors for programming that support the secondary selection clipboard?

2017-06-21 Thread Luca Ferrari
On Tue, Jun 20, 2017 at 10:32 PM, ToddAndMargo wrote: > Hi All, > > I like Geany, but it does not support the "Secondary Selection" > clipboard. This clipboard would save me a bunch of time as > I would not lose my cursor hot spot. Emacs

Re: Associative collection with automatic keys?

2017-04-05 Thread Luca Ferrari
On Tue, Apr 4, 2017 at 11:31 AM, Trey Ethan Harris wrote: > (I can use classify-list to do this ad-hoc, or even just do a simple map as > I might in Perl 5, but I'm thinking of each key's relationship to and > extraction from its value as being a feature of the collection,

Re: program/script question

2017-03-07 Thread Luca Ferrari
On Sun, Mar 5, 2017 at 4:23 AM, ToddAndMargo wrote: > Hi All, > > This is one of those really dumb questions, but can I call > what I write in Perl a "program" or a "script"? Or, does > it even matter? > My point of view is it does not matter. Usually a script is

Re: Your thoughts on Padre?

2017-02-27 Thread Luca Ferrari
On Mon, Feb 27, 2017 at 4:32 PM, Brandon Allbery <allber...@gmail.com> wrote: > On Mon, Feb 27, 2017 at 9:39 AM, Luca Ferrari <fluca1...@infinito.it> wrote: >> >> On Sat, Feb 25, 2017 at 1:26 AM, Brandon Allbery <allber...@gmail.com> >> wrote: >> >

Re: Your thoughts on Padre?

2017-02-27 Thread Luca Ferrari
On Sat, Feb 25, 2017 at 1:26 AM, Brandon Allbery wrote: > Padre's maintained? I thought it died years ago. > Seems to me it is one year old now: . I personally use spacemacs with perl6 mode and it does the job for me. Luca

Re: inline question

2017-01-18 Thread Luca Ferrari
On Tue, Jan 17, 2017 at 6:35 PM, ToddAndMargo wrote: > Does Perl 5 have to be installed to get Inline work? Or just a path > to the downloaded perl5 module(s)? See the BUILDING section for more details: Luca

Re: panda?

2017-01-13 Thread Luca Ferrari
On Fri, Jan 13, 2017 at 10:16 AM, Todd Chester wrote: > Hi All, > > I am using Fedora Core 25. There is no sign of "panda" > in the repo (or I don't know what it is called). I don't know why is not there, but searching panda on

Re: autodie???

2016-11-21 Thread Luca Ferrari
On Mon, Nov 21, 2016 at 4:21 AM, ToddAndMargo wrote: > What does perl-autodie do (RHEL 7)? Here it is well explained: . Luca

Re: tail call optimization

2016-11-18 Thread Luca Ferrari
On Fri, Nov 18, 2016 at 4:57 AM, Andrew Kirkpatrick wrote: > But IIRC goto is more about fooling caller() than TCO, so its > not that really fast thing some users expect. Yes, it's more a way to not change the call stack than to optimize it. Luca

rakudobrew failing to build moar

2016-10-12 Thread Luca Ferrari
Hi, not sure if this is the right place to get some help, in the case this is wrong please redirect me to the right mailing list. I'm trying to build moar via rakudobrew: % rakudobrew build moar ... /home/luca/.rakudobrew/moar-nom/install/bin/moar

doubt about sequence operator

2016-10-10 Thread Luca Ferrari
Hi all, I'm misunderstanding the ... operator. The following works as expected: @seq = ( 1, 2, -> $a, $b { $a * 2 + $b % 2 } ... * )[^10]; while the following seems to loop infinitely: @seq = ( 1, 2, -> $a, $b { $a * 2 + $b % 2 } ... 10 ); Looking at

Re: can Perl 6 bootstrap itself

2016-08-26 Thread Luca Ferrari
I don't see the real problem in having Perl6 requiring Perl5 to build itself, at least not in the long term. So far the world simply cannot survive without Perl5, but one day all applications will be hopefully rewritten in Perl6 and so will be the tools. In the meantime I guess the best and

Re: can a method name contain a funny character?

2016-04-12 Thread Luca Ferrari
On Tue, Apr 12, 2016 at 9:44 AM, Theo van den Heuvel wrote: > > Why? Perhaps you are confusing taste and good sense. The heart is just an > example. My intention is for a mathematical symbol and a mathematical > meaning. I see nothing wrong with that. unless you have to

books on p6?

2016-03-10 Thread Luca Ferrari
Hi all, anybody knows of ongoing efforts for Perl 6 related books? I suspect O'reilly title is pretty much out of date, or am I wrong? Thanks, Luca

learnyou...perl 6

2016-02-08 Thread Luca Ferrari
Hi all, maybe this is trivial but somedays ago I step thru learnyounode , a kind of tutorial with some problems, hint and solution that guides you to learn node.js. I was searching something similar for Perl6, if it does exist. I know the 99 problems

Re: Perl 6 Module and Program File Extension Conventions?

2016-01-14 Thread Luca Ferrari
On Wed, Jan 13, 2016 at 3:25 PM, Kaare Rasmussen wrote: > But I don't know why they still suggest to use any specific suffix. It's of > now interest or value to the user in which language the program is written. > I suspect it does matter in order to get the right tools to

Re: Perl 6 Module and Program File Extension Conventions?

2016-01-13 Thread Luca Ferrari
On Tue, Jan 12, 2016 at 10:49 PM, Parrot Raiser <1parr...@gmail.com> wrote: > Looking at the documentation, http://doc.perl6.org/language/modules > see "Basic structure". One thing I get from the module example is about the 6 suffix in