Re: I need help with ~~m/

2021-01-30 Thread Patrick R. Michaud
On Sat, Jan 30, 2021 at 05:52:54PM -0800, Joseph Brenner wrote: > Which means there's some potential confusion if you really need > to match quotes: > > my $str = 'string_632="The chicken says--", voice="high"'; > > say > $str ~~ m:g{ ( " .*? " ) }; # False > say > $str

Re: I need help with ~~m/

2021-01-30 Thread ToddAndMargo via perl6-users
On 1/30/21 5:52 PM, Joseph Brenner wrote: I think ToddAndMargo was thinking of perl5 regexes, where [.] is a good way of matching a literal dot-- though myself, I'm more inclined to use \. In Raku, the square brackets just do non-capturing grouping much like (?: ... } in perl5. To do a characte

Re: I need help with ~~m/

2021-01-30 Thread Joseph Brenner
> My mistake was think that if a value at the end > did not exist, I was given back a null. Now I know > to look for a false. > > say "1.33" ~~ m/(\d+) ** 3..4 % "." / > False That pattern says there has to be three or four fields of digits, so if you don't have that many, the entire match has t

Re: I need help with ~~m/

2021-01-30 Thread Joseph Brenner
I think ToddAndMargo was thinking of perl5 regexes, where [.] is a good way of matching a literal dot-- though myself, I'm more inclined to use \. In Raku, the square brackets just do non-capturing grouping much like (?: ... } in perl5. To do a character class, you need angles around the squares.

Re: I need help with ~~m/

2021-01-30 Thread ToddAndMargo via perl6-users
On 1/30/21 1:03 AM, William Michels via perl6-users wrote: Hi Todd (and JJ), On Fri, Jan 29, 2021 at 11:58 PM JJ Merelo wrote: El sáb, 30 ene 2021 a las 7:24, ToddAndMargo via perl6-users () escribió: Hi All, rakudo-pkg-2020.12-01.x86_64 Why does this work? > $x = "1.33.222.4"; 1.33

Re: I need help with ~~m/

2021-01-30 Thread William Michels via perl6-users
Hi Todd (and JJ), On Fri, Jan 29, 2021 at 11:58 PM JJ Merelo wrote: > > > > El sáb, 30 ene 2021 a las 7:24, ToddAndMargo via perl6-users > () escribió: >> >> Hi All, >> >> rakudo-pkg-2020.12-01.x86_64 >> >> Why does this work? >> >> > $x = "1.33.222.4"; >> 1.33.222.4 >> > $x ~~ m/ (<:N>+) [.]

Re: I need help with ~~m/

2021-01-29 Thread JJ Merelo
El sáb, 30 ene 2021 a las 7:24, ToddAndMargo via perl6-users (< perl6-users@perl.org>) escribió: > Hi All, > > rakudo-pkg-2020.12-01.x86_64 > > Why does this work? > > > $x = "1.33.222.4"; > 1.33.222.4 > > $x ~~ m/ (<:N>+) [.] (<:N>+) [.] (<:N>+) [.] (<:N>+) /; > 「1.33.222.4」 > 0 => 「1」 > 1

I need help with ~~m/

2021-01-29 Thread ToddAndMargo via perl6-users
Hi All, rakudo-pkg-2020.12-01.x86_64 Why does this work? > $x = "1.33.222.4"; 1.33.222.4 > $x ~~ m/ (<:N>+) [.] (<:N>+) [.] (<:N>+) [.] (<:N>+) /; 「1.33.222.4」 0 => 「1」 1 => 「33」 2 => 「222」 3 => 「4」 But this does not? --> Why the wrong number in $2? --> Why no Nil for $3? > $x = "

Re: I need help understanding ".contains" method construction

2020-12-28 Thread ToddAndMargo via perl6-users
On 12/28/20 7:11 AM, Parrot Raiser wrote: "Definition of invoke transitive verb 1a : to petition for help or support b : to appeal to or cite as authority 2 : to call forth by incantation : conjure 3 : to make an earnest request for : solicit 4 :

Re: I need help understanding ".contains" method construction

2020-12-28 Thread Parrot Raiser
"Definition of invoke transitive verb 1a : to petition for help or support b : to appeal to or cite as authority 2 : to call forth by incantation : conjure 3 : to make an earnest request for : solicit 4 : to put into effect or operation : implement

Re: I need help understanding ".contains" method construction

2020-12-27 Thread ToddAndMargo via perl6-users
On 12/26/20 2:50 PM, Ralph Mellor wrote: Is this .self with a better name? No. I know you've been progressing in your understanding of OO in general, and Raku's in particular, since you wrote this email. So I won't explain it for now, but rather just try to confirm you now know what that bit of

Re: I need help understanding ".contains" method construction

2020-12-27 Thread ToddAndMargo via perl6-users
On 12/19/20 11:04 PM, ToddAndMargo via perl6-users wrote: Hi All, https://github.com/rakudo/rakudo/blob/master/src/core.c/Str.pm6 337:multi method contains(Str:D: Str:D $needle --> Bool:D) { 338:nqp::hllbool(nqp::isne_i(nqp::index($!value,$needle,0),-1)) 339:} I "presume" in "abcd".con

Re: I need help understanding ".contains" method construction

2020-12-26 Thread Ralph Mellor
> >> What kind of variable is .value? > > > > I don't see a `.value`, only a `$!value`. > > Is this .self with a better name? No. I know you've been progressing in your understanding of OO in general, and Raku's in particular, since you wrote this email. So I won't explain it for now, but rat

Re: I need help understanding ".contains" method construction

2020-12-23 Thread Todd Chester via perl6-users
On 12/23/20 4:39 PM, Ralph Mellor wrote: 1) why is it "$needle" and not "$!needle" on line 338? Is this because it is an internal variable and not a variable from the class declaration? Got it It's a parameter from line 337. If that's what you mean by "an internal variable", then y

Re: I need help understanding ".contains" method construction

2020-12-23 Thread Ralph Mellor
>1) why is it "$needle" and not "$!needle" on line 338? >Is this because it is an internal variable and not >a variable from the class declaration? It's a parameter from line 337. If that's what you mean by "an internal variable", then yes. :) >2) where is variable ".value" defined on lin

Re: I need help with cosine and ()

2020-12-20 Thread ToddAndMargo via perl6-users
On 12/20/20 10:11 AM, Bruce Gray wrote: $a + $b - $c * $d / $e.foo , the .foo method is called on $e, not on the whole A-through-E sub-expression. That makes sense. It is the precidence. In college, we called it "algebraic operation". ** came before *; * came before +; etc In Raku, a m

Re: I need help with cosine and ()

2020-12-20 Thread Bruce Gray
> On Dec 20, 2020, at 6:08 AM, ToddAndMargo via perl6-users > wrote: > >>> On Sun, Dec 20, 2020 at 02:05 ToddAndMargo via perl6-users >>> mailto:perl6-users@perl.org>> wrote: >>>Hi All, >>>Why does this work? >>> say (45*π/180).cos >>> 0.7071067811865476 >>>And

Re: I need help with cosine and ()

2020-12-20 Thread ToddAndMargo via perl6-users
On Sun, Dec 20, 2020 at 02:05 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: Hi All, Why does this work? say (45*π/180).cos 0.7071067811865476 And this not? say 45*π/180.cos -236.22573454917193 Is not the math suppose

I need help with cosine and ()

2020-12-20 Thread ToddAndMargo via perl6-users
Hi All, Why does this work? say (45*π/180).cos 0.7071067811865476 And this not? say 45*π/180.cos -236.22573454917193 Is not the math suppose to be done first? Confused again, -T

Re: I need help setting up a method

2020-12-19 Thread ToddAndMargo via perl6-users
On 12/19/20 8:21 PM, Bruce Gray wrote: With a custom `new` method, that could be shortened further to: say BadMath.new(2, 2).BadAdd; print BadMath.new(2, 2).BadAdd ~ "\n"; Default constructor for 'BadMath' only takes named arguments in block at line 1 What am I missing?

I need help understanding ".contains" method construction

2020-12-19 Thread ToddAndMargo via perl6-users
Hi All, https://github.com/rakudo/rakudo/blob/master/src/core.c/Str.pm6 337:multi method contains(Str:D: Str:D $needle --> Bool:D) { 338:nqp::hllbool(nqp::isne_i(nqp::index($!value,$needle,0),-1)) 339:} I "presume" in "abcd".contains("bc") "abcd" is `$!value`, and "bc" is $needle. Do

Re: I need help setting up a method

2020-12-19 Thread ToddAndMargo via perl6-users
On 12/19/20 8:21 PM, Bruce Gray wrote: On Dec 19, 2020, at 6:40 PM, ToddAndMargo via perl6-users wrote: Hi All, I have so far: class BadMath { has Int $.A; has Int $.B; method BadAdd() { my $Clinker = (-5..5).rand.truncate; return $!A + $!B +

Re: I need help setting up a method

2020-12-19 Thread Bruce Gray
> On Dec 19, 2020, at 6:40 PM, ToddAndMargo via perl6-users > wrote: > > Hi All, > > I have so far: > > > class BadMath { > has Int $.A; > has Int $.B; > > method BadAdd() { > my $Clinker = (-5..5).rand.truncate; > return $!A + $!B + $Clinker; >

I need help setting up a method

2020-12-19 Thread ToddAndMargo via perl6-users
Hi All, I have so far: class BadMath { has Int $.A; has Int $.B; method BadAdd() { my $Clinker = (-5..5).rand.truncate; return $!A + $!B + $Clinker; } } my $TwoPlusTwo = BadMath.new( A => 2, B=> 2 ); print $TwoPlusTwo.BadAdd ~ "\n"

Re: Need help understand "class"

2020-12-08 Thread Curt Tilmes
On Tue, Dec 8, 2020 at 7:05 PM ToddAndMargo via perl6-users wrote: > I guess what I am missing is how > > int cupsEnumDests(unsigned flags, int msec, int *cancel, cups_ptype_t > type, cups_ptype_t mask, cups_dest_cb_t cb, void *user_data); > > matches up with > > class CupsDest is repr('CStruct'

Re: Need help understand "class"

2020-12-08 Thread ToddAndMargo via perl6-users
Hi All, In the following piece of code: use NativeCall; class CupsDest is repr('CStruct') { has Str $.name; has Str $.instance; has int32 $.is-default; has Pointer $.options; } sub cupsGetDests(Pointer is rw --> int32) is native('cups', v2) {} Would some kind soul pl

Re: Need help understand "class"

2020-12-08 Thread Andy Bach
he "nativesizeof" gives the size of the struct, so the $ptr + $i * nativesizeof(CupsDest) moves the new Pointer down the list one struct at a time. From: ToddAndMargo via perl6-users Sent: Monday, December 7, 2020 10:36 PM To: perl6-users Subject: Need

Need help understand "class"

2020-12-07 Thread ToddAndMargo via perl6-users
Hi All, In the following piece of code: use NativeCall; class CupsDest is repr('CStruct') { has Str $.name; has Str $.instance; has int32 $.is-default; has Pointer $.options; } sub cupsGetDests(Pointer is rw --> int32) is native('cups', v2) {} Would some kind soul please exp

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 16:08, Peter Pentchev wrote: Yes, I know. Git does take some getting used to; any program does. With time, you may find it useful. The things you do all the time, you remember. Since I am IT support to small business and do EVERYTHING, except the wiring, which I have guys that d

Re: I need help finding a class for a method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 04:01:41PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-08 15:35, Peter Pentchev wrote: > > On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-06-08 15:02, Peter Pentchev wrote: > > > > On Mon, Jun 08, 2020 at 02:57:58

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 15:35, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 15:02, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 14:54, Peter Pentchev wrote: On Mon,

Re: I need help finding a class for a method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-08 15:02, Peter Pentchev wrote: > > On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-06-08 14:54, Peter Pentchev wrote: > > > > On Mon, Jun 08, 2020 at 02:48:48

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 15:02, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 14:54, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 13:55, Richard Hainsworth wrote: [sni

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 14:57, ToddAndMargo via perl6-users wrote: On 2020-06-08 14:54, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 13:55, Richard Hainsworth wrote: [snip] The opening bracket for class Informing is on (or about) line

Re: I need help finding a class for a method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-08 14:54, Peter Pentchev wrote: > > On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-06-08 13:55, Richard Hainsworth wrote: > > [snip] > > > > The opening brack

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 14:54, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 13:55, Richard Hainsworth wrote: [snip] The opening bracket for class Informing is on (or about) line 10 and the closing in at about line 630, with a comment '

Re: I need help finding a class for a method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-08 13:55, Richard Hainsworth wrote: [snip] > > The opening bracket for class Informing is on (or about) line 10 and the > > closing in at about line 630, with a comment 'end of Informing class' > > > > Richa

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 13:55, Richard Hainsworth wrote: Todd, The 'unit' in line 3 means something like 'this whole file is the Module' so there are no Begins/Ends/brackets. Poop. I spaced on that. I start all my moduels with 1: unit module ; The opening bracket for class Informing is on (or ab

Re: I need help finding a class for a method

2020-06-08 Thread Richard Hainsworth
Todd, The 'unit' in line 3 means something like 'this whole file is the Module' so there are no Begins/Ends/brackets. The opening bracket for class Informing is on (or about) line 10 and the closing in at about line 630, with a comment 'end of Informing class' Richard On 08/06/2020 21:47,

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 05:35, Fernando Santagata wrote: On Mon, Jun 8, 2020 at 2:11 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 2020-06-08 04:32, Fernando Santagata wrote: > On Mon, Jun 8, 2020 at 1:20 PM ToddAndMargo via perl6-users > mailto:perl6-users@perl.or

Re: I need help finding a class for a method

2020-06-08 Thread Fernando Santagata
On Mon, Jun 8, 2020 at 2:11 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-06-08 04:32, Fernando Santagata wrote: > > On Mon, Jun 8, 2020 at 1:20 PM ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > On 2020-06-08 03:38, Fernando Santagata w

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 04:32, Fernando Santagata wrote: On Mon, Jun 8, 2020 at 1:20 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 2020-06-08 03:38, Fernando Santagata wrote:  > …and line 3:  >  > unit module Informative;  > 3: unit module Informati

Re: I need help finding a class for a method

2020-06-08 Thread Fernando Santagata
On Mon, Jun 8, 2020 at 1:20 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-06-08 03:38, Fernando Santagata wrote: > > …and line 3: > > > > unit module Informative; > > > > > 3: unit module Informative; > > Does not look like a class to me. What am I missing? > It's

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On Mon, Jun 8, 2020 at 12:35 PM Richard Hainsworth mailto:rnhainswo...@gmail.com>> wrote: Look at line 10 class Informing { On 08/06/2020 11:31, ToddAndMargo via perl6-users wrote: Hi All, Over on https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
>> Hi All, >> >> Over on >> >> https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6 >> >> Line 144: >> >> method show( >> Str $str?, >> Int :$timer, >> Bool :$show-countdown >> ) { >> >> where is the class that is linked to tha

Re: I need help finding a class for a method

2020-06-08 Thread Fernando Santagata
…and line 3: unit module Informative; On Mon, Jun 8, 2020 at 12:35 PM Richard Hainsworth wrote: > Look at line 10 > > class Informing { > > > On 08/06/2020 11:31, ToddAndMargo via perl6-users wrote: > > Hi All, > > Over on > > https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.

Re: I need help finding a class for a method

2020-06-08 Thread Richard Hainsworth
Look at line 10 class Informing { On 08/06/2020 11:31, ToddAndMargo via perl6-users wrote: Hi All, Over on https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6 Line 144:     method show(     Str $str?,     Int :$timer,     Bool :$show-countdown

I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
Hi All, Over on https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6 Line 144: method show( Str $str?, Int :$timer, Bool :$show-countdown ) { where is the class that is linked to that method? Many thanks, -T

Re: I need help with Config:INI

2020-05-30 Thread ToddAndMargo via perl6-users
On 2020-05-30 20:08, ToddAndMargo via perl6-users wrote: Follow up. I just opened An Example to consider adding to your documentation: https://github.com/tadzik/perl6-Config-INI/issues/17

Re: I need help with Config:INI

2020-05-30 Thread ToddAndMargo via perl6-users
Follow up. Special thanks to Peter and David! I wrote a sample program to explain things in my personal documentation: -T Raku: reading INI files: Example: ~ini.test.pl6.ini ~~~ # Raku: Config::INI test INI # edit at your own risk IHave=NoSection [Backup paramters] target

Re: I need help with Config:INI

2020-05-30 Thread David Santiago
Hope this helps :-) Basically the %hash variable contains another hash, and with spaces in keys you cannot use them with "<>" use Config; use Config::INI; my Str $IniFile = slurp "config.ini"; my %hash = Config::INI::parse($IniFile); dd %hash; print "\n"; for %hash.kv -> $section_name, %secti

Re: I need help with Config:INI

2020-05-30 Thread Peter Pentchev
On Fri, May 29, 2020 at 05:02:15PM -0700, ToddAndMargo via perl6-users wrote: > Hi All, > > I an not figure out how to read the hash. > > > ~~~ ini.test.pl6.ini ~ > # Raku: Confug::INI test INI > # edit at your own risk > > [Backup paramters] > target=B:\myDocsBackp\backup1

I need help with Config:INI

2020-05-29 Thread ToddAndMargo via perl6-users
Hi All, I an not figure out how to read the hash. ~~~ ini.test.pl6.ini ~ # Raku: Confug::INI test INI # edit at your own risk [Backup paramters] target=B:\myDocsBackp\backup1 partition=BACKUP [eMail] smtp=smtp.bozo.com address=b...@theclown.com port=587 ~~~ /ini.te

Re: I need help testing for Nil

2020-05-26 Thread ToddAndMargo via perl6-users
On 2020-05-26 16:29, Brad Gilbert wrote: There are various equality operators. 「==」 Tests for numeric equality 「eq」 Tests for string equality 「===」 Tests for value identity 「=:=」 Tests for pointer equality (Note that it looks a bit like 「:=」) 「eqv」 Tests for structure equivalence. The 「==」 and

Re: I need help testing for Nil

2020-05-26 Thread Brad Gilbert
There are various equality operators. 「==」 Tests for numeric equality 「eq」 Tests for string equality 「===」 Tests for value identity 「=:=」 Tests for pointer equality (Note that it looks a bit like 「:=」) 「eqv」 Tests for structure equivalence. The 「==」 and 「eq」 operators are special because they for

Re: I need help testing for Nil

2020-05-26 Thread ToddAndMargo via perl6-users
On Tue, May 26, 2020 at 4:24 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: Hi All, How do I turn this: $ raku -e 'my $x="abc"; say $x.index( "q" );' Nil into a test? $ raku -e 'my $x="abc"; if $x.index( "q" ) eq Nil {say "Nil"}else{say "Exis

Re: I need help testing for Nil

2020-05-26 Thread Brad Gilbert
Generally you don't need to test for 「Nil」. You can just test for defined-ness. $ raku -e 'my $x="abc"; with $x.index( "q" ) {say "Exists"} else {say "Nil";}' Also 「Nil」 is not a 「Str」, so why would you use 「eq」? $ raku -e 'Nil.Str' Use of Nil in string context If you really need to

I need help testing for Nil

2020-05-26 Thread ToddAndMargo via perl6-users
Hi All, How do I turn this: $ raku -e 'my $x="abc"; say $x.index( "q" );' Nil into a test? $ raku -e 'my $x="abc"; if $x.index( "q" ) eq Nil {say "Nil"}else{say "Exists";}' Use of Nil in string context in block at -e line 1 Use of Nil in string context in block at -e line 1 Nil Many

Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 2020-05-24 15:51, Patrick R. Michaud wrote: On Mon, May 25, 2020 at 12:07:22AM +0200, Tobias Boege wrote: @things.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self }) } Or how about even somethig like @things.sort: *.Version; which does handle a reasonable set of

Re: I need help sorting a list

2020-05-24 Thread Patrick R. Michaud
On Mon, May 25, 2020 at 12:07:22AM +0200, Tobias Boege wrote: > @things.sort: { > .comb(/ \d+ | \D+ /) > .map({ .Int // .self }) > } Or how about even somethig like @things.sort: *.Version; which does handle a reasonable set of version semantics...? (The .Version method was

Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 2020-05-24 15:39, ToddAndMargo via perl6-users wrote: On 2020-05-24 15:07, Tobias Boege wrote: On Sun, 24 May 2020, Elizabeth Mattijsen wrote: Hmmm... it appears we need to numerify the match to get numeric comparison semantics, so we put a "+" before the match: $ raku -e 'my @x=.sort: { +

Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 2020-05-24 15:07, Tobias Boege wrote: On Sun, 24 May 2020, Elizabeth Mattijsen wrote: Hmmm... it appears we need to numerify the match to get numeric comparison semantics, so we put a "+" before the match: $ raku -e 'my @x=.sort: { +m/ \d+ $/ }; for @x { say $_; }' a1 a2 a5 a123 a133 So

Re: I need help sorting a list

2020-05-24 Thread Tobias Boege
On Sun, 24 May 2020, Elizabeth Mattijsen wrote: > Hmmm... it appears we need to numerify the match to get numeric comparison > semantics, so we put a "+" before the match: > > $ raku -e 'my @x=.sort: { +m/ \d+ $/ }; for @x { say $_; > }' > a1 > a2 > a5 > a123 > a133 > So I think this would be

Re: I need help sorting a list

2020-05-24 Thread Elizabeth Mattijsen
: > > >>> On 24 May 2020, at 10:43, ToddAndMargo via perl6-users >>> wrote: >>> >>> Hi All, >>> >>> https://docs.raku.org/routine/sort >>> >>> I need help sorting a list. >>> >>> This is the list

Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 2020-05-24 13:13, Tobias Boege wrote: On Sun, 24 May 2020, ToddAndMargo via perl6-users wrote: On 2020-05-24 02:24, Elizabeth Mattijsen wrote: dd .sort: { m/ \d+ $/ } Hi Elizabeth, This seems to work: $ raku -e 'dd .sort: { m/ \d+ $/ };' ("a5", "a6", "a33", "a111").Seq But I c

Re: I need help sorting a list

2020-05-24 Thread Tobias Boege
On Sun, 24 May 2020, ToddAndMargo via perl6-users wrote: > On 2020-05-24 02:24, Elizabeth Mattijsen wrote: > > dd .sort: { m/ \d+ $/ } > > > > Hi Elizabeth, > > This seems to work: > >$ raku -e 'dd .sort: { m/ \d+ $/ };' >("a5", "a6", "a33", "a111").Seq > > > But I can't figure out how

Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 24 May 2020, at 10:43, ToddAndMargo via perl6-users wrote: Hi All, https://docs.raku.org/routine/sort I need help sorting a list. This is the list of values I want to sort: H:\MyDocsBackup\backup1 H:\MyDocsBackup\backup2 H:\MyDocsBackup\backup126 H:\MyDocsBackup\backup3 H

Re: I need help sorting a list

2020-05-24 Thread Elizabeth Mattijsen
dd .sort: { m/ \d+ $/ } > On 24 May 2020, at 10:43, ToddAndMargo via perl6-users > wrote: > > Hi All, > > https://docs.raku.org/routine/sort > > I need help sorting a list. > > This is the list of values I want to sort: > > H:\MyDocsBackup\b

I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
Hi All, https://docs.raku.org/routine/sort I need help sorting a list. This is the list of values I want to sort: H:\MyDocsBackup\backup1 H:\MyDocsBackup\backup2 H:\MyDocsBackup\backup126 H:\MyDocsBackup\backup3 H:\MyDocsBackup\backup33 H:\MyDocsBackup\backup6 This is what I want back: H

Re: I need help with IO.e

2020-05-22 Thread ToddAndMargo via perl6-users
On 2020-05-19 05:17, Peter Pentchev wrote: ...control structures, I mean. G'luck, Peter No problem, I appreciate all the help! :-) -T

Re: I need help with IO.e

2020-05-19 Thread Peter Pentchev
On Tue, May 19, 2020 at 03:16:41PM +0300, Peter Pentchev wrote: > On Mon, May 18, 2020 at 10:58:26PM -0700, ToddAndMargo via perl6-users wrote: > > On 2020-05-18 17:14, Peter Pentchev wrote: > > > On Mon, May 18, 2020 at 04:53:31PM -0700, ToddAndMargo via perl6-users > > > wrote: > > > > In 2020-0

Re: I need help with IO.e

2020-05-19 Thread Peter Pentchev
On Mon, May 18, 2020 at 10:58:26PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-18 17:14, Peter Pentchev wrote: > > On Mon, May 18, 2020 at 04:53:31PM -0700, ToddAndMargo via perl6-users > > wrote: > > > In 2020-05-18 16:11, Peter Pentchev wrote: > > > > As an exercise for the reader: o

Re: I need help with IO.e

2020-05-19 Thread Tom Browder
On Tue, May 19, 2020 at 03:44 Richard Hainsworth wrote: > The transcendental abundance of purple in Raku :) Ah, Richard, thanks for a trip down memory lane! In my youth I discovered the joys of science fiction a few years after that piece was published. -Tom

Re: I need help with IO.e

2020-05-19 Thread Richard Hainsworth
Peter, What a genius answer! The transcendental abundance of purple in Raku :) On 18/05/2020 22:26, Peter Pentchev wrote: It's the internal representation of the program you told Raku to parse and execute; the truth is that, just like in a sci-fi story about a machine that is supposed to answ

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-18 22:58, ToddAndMargo via perl6-users wrote: On 2020-05-18 17:14, Peter Pentchev wrote: On Mon, May 18, 2020 at 04:53:31PM -0700, ToddAndMargo via perl6-users wrote: In 2020-05-18 16:11, Peter Pentchev wrote: As an exercise for the reader: once the above sinks in, what exactly will

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-18 17:14, Peter Pentchev wrote: On Mon, May 18, 2020 at 04:53:31PM -0700, ToddAndMargo via perl6-users wrote: In 2020-05-18 16:11, Peter Pentchev wrote: As an exercise for the reader: once the above sinks in, what exactly will "say if 'h:/'.IO.d" do? It returns the the result of th

Re: I need help with IO.e

2020-05-18 Thread Peter Pentchev
On Mon, May 18, 2020 at 04:53:31PM -0700, ToddAndMargo via perl6-users wrote: > In 2020-05-18 16:11, Peter Pentchev wrote: > > As an exercise for the reader: once the above sinks in, what exactly > > will "say if 'h:/'.IO.d" do? > > It returns the the result of the expression that > "if" evaluated

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
In 2020-05-18 16:11, Peter Pentchev wrote: As an exercise for the reader: once the above sinks in, what exactly will "say if 'h:/'.IO.d" do? It returns the the result of the expression that "if" evaluated. I do know all this. It is easier for me to read the other way.

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-18 16:01, Tom Browder wrote: Since you don't like to listen to advice I give up. Tom! I listen to your advice ALL-THE-TIME. I was just interested in something else. And when I did not understand the result, your way or my way, I abandoned the effort, especially since I did not nee

Re: I need help with IO.e

2020-05-18 Thread Peter Pentchev
On Mon, May 18, 2020 at 03:51:30PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-18 15:44, Tom Browder wrote: > > On Mon, May 18, 2020 at 16:19 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > On 2020-05-18 13:28, Tom Browder wrote: > > > > ... > > > >

Re: I need help with IO.e

2020-05-18 Thread Tom Browder
On Mon, May 18, 2020 at 17:51 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-18 15:44, Tom Browder wrote: > > On Mon, May 18, 2020 at 16:19 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > On 2020-05-18 13:28, Tom Browder wrote: > > > > ..

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-18 15:44, Tom Browder wrote: On Mon, May 18, 2020 at 16:19 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 2020-05-18 13:28, Tom Browder wrote: ... > Try: > > 'say so "test".IO.d' Todd, you didn't try what I suggested. Once again, look a th

Re: I need help with IO.e

2020-05-18 Thread Tom Browder
On Mon, May 18, 2020 at 16:19 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-18 13:28, Tom Browder wrote: ... > > Try: > > > > 'say so "test".IO.d' Todd, you didn't try what I suggested. Once again, look a the line above^^ There is no "if" there. -Tom

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-18 15:38, Peter Pentchev wrote: On Mon, May 18, 2020 at 03:18:26PM -0700, ToddAndMargo via perl6-users wrote: On 2020-05-18 14:35, Peter Pentchev wrote: My point is that you put a bare "say" without telling it*what* to say, which does something quite specific in both Perl and Raku.

Re: I need help with IO.e

2020-05-18 Thread Peter Pentchev
On Mon, May 18, 2020 at 03:18:26PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-18 14:35, Peter Pentchev wrote: > > My point is that you put a bare "say" without telling it*what* to say, > > which does something quite specific in both Perl and Raku. That should, > > at least, explain th

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-18 14:35, Peter Pentchev wrote: My point is that you put a bare "say" without telling it*what* to say, which does something quite specific in both Perl and Raku. That should, at least, explain the error-like message. G'luck, Peter What I was after was to see what impact I had coerc

Re: I need help with IO.e

2020-05-18 Thread Peter Pentchev
On Mon, May 18, 2020 at 02:32:49PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-18 14:22, Peter Pentchev wrote: > > Please note that in my example a couple of messages ago I did not write > > "say if 'h:/'.IO.d", I wrote "say 'yes' if 'h:/'.IO.d". The difference > > is very important and

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-18 14:22, Peter Pentchev wrote: Please note that in my example a couple of messages ago I did not write "say if 'h:/'.IO.d", I wrote "say 'yes' if 'h:/'.IO.d". The difference is very important and leads directly to the error-like message you got. Hi Peter, I as interested in the .d

Re: I need help with IO.e

2020-05-18 Thread Peter Pentchev
On Tue, May 19, 2020 at 12:22:55AM +0300, Peter Pentchev wrote: > On Mon, May 18, 2020 at 12:35:47PM -0700, ToddAndMargo via perl6-users wrote: > > On 2020-05-17 22:28, Paul Procacci wrote: > > > Don't 'say' anything.  Just let the optimizer spit out the QAST that you > > > are interested in lookin

Re: I need help with IO.e

2020-05-18 Thread Peter Pentchev
On Mon, May 18, 2020 at 12:35:47PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-05-17 22:28, Paul Procacci wrote: > > Don't 'say' anything.  Just let the optimizer spit out the QAST that you > > are interested in looking at. > > The following spits out a diff after optimization: > > > > #

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-18 13:28, Tom Browder wrote: On Mon, May 18, 2020 at 14:36 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 2020-05-17 22:28, Paul Procacci wrote: ... 'say if "test".IO.d',  and 'say "test".IO.d.Bool' Try: 'say so "test".IO.d' I have mo clue th

Re: I need help with IO.e

2020-05-18 Thread Tom Browder
On Mon, May 18, 2020 at 14:36 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-17 22:28, Paul Procacci wrote: ... > 'say if "test".IO.d', and > 'say "test".IO.d.Bool' Try: 'say so "test".IO.d'

Re: I need help with IO.e

2020-05-18 Thread ToddAndMargo via perl6-users
On 2020-05-17 22:28, Paul Procacci wrote: Don't 'say' anything.  Just let the optimizer spit out the QAST that you are interested in looking at. The following spits out a diff after optimization: # diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6 --target=optimize -e '"test".IO.e.Bo

Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
Don't 'say' anything. Just let the optimizer spit out the QAST that you are interested in looking at. The following spits out a diff after optimization: # diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6 --target=optimize -e '"test".IO.e.Bool') >> Huh. Not sure what I am looking at

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 21:48, Paul Procacci wrote: You can check this yourself by looking at the QAST nodes after the static analyzer has had its fill: # diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6 --target=optimize -e '"test".IO.e.Bool') Huh. Not sure what I am looking at $ diff -

Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
You can check this yourself by looking at the QAST nodes after the static analyzer has had its fill: # diff -u <(perl6 --target=optimize -e '"test".IO.e') <(perl6 --target=optimize -e '"test".IO.e.Bool') On Mon, May 18, 2020 at 12:25 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote:

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 21:19, ToddAndMargo via perl6-users wrote: On 2020-05-17 20:28, Paul Procacci wrote: So tack a .Bool at the end. You are coercing a bool to a bool by doing so and hopefully the optimizer is smart enough for people who like to be redundant. ;) Hi Paul, Especially when I can ne

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 20:28, Paul Procacci wrote: So tack a .Bool at the end. You are coercing a bool to a bool by doing so and hopefully the optimizer is smart enough for people who like to be redundant. ;) Hi Paul, Especially when I can never remember when IO.someletter will return a full True or

Re: I need help with IO.e

2020-05-17 Thread Paul Procacci
So tack a .Bool at the end. You are coercing a bool to a bool by doing so and hopefully the optimizer is smart enough for people who like to be redundant. ;) On Sun, May 17, 2020 at 6:10 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-05-17 14:43, ToddAndMargo via perl6-

Re: I need help with IO.e

2020-05-17 Thread ToddAndMargo via perl6-users
On 2020-05-17 14:43, ToddAndMargo via perl6-users wrote: Although    "say 'yes' if 'h:/'.IO.d" is obscure to me and    "say 'h:/'.IO.d.Bool" is very easy for me to understand. Hi Peter, I think it would help if you knew how my mind worked. `if` to me is a Boolean function. If this exp

  1   2   3   >