Re: slurpy hash signatures

2021-04-23 Thread Ralph Mellor
On Wed, Apr 21, 2021 at 2:17 AM Joseph Brenner wrote: > Ralph Mellor wrote: > > [ list of idioms ] > > > Learn to use the right idioms as soon as possible. > > Okay. Where's the list of preferred idioms? The list you presented. If you had or have chosen %h3 as the "right" idiom from among the

Re: slurpy hash signatures

2021-04-20 Thread Joseph Brenner
Ralph Mellor wrote: > Joseph Brenner wrote: > > > Before I get started here, a small point about defining hashes. > > There are various ways that work: > > > >my %h1 = ( 'ha' => 1, 'ho' => 2, 'hum' => 3 ); > >my %h2 = ( ha => 1, ho => 2, hum => 3 ); > >my %h3 = ha => 1, ho =>

Re: slurpy hash signatures

2021-04-19 Thread Ralph Mellor
Btw, I had misunderstood ERN when, in 2018, I wrote the email message I linked in the Note section of my previous email. ERN is an intuitive sense that some movement you are initiating is in some way a mistake. For example, quoting keys of a pair. It's often unconscious, and, aiui, ignoring it ent

Re: slurpy hash signatures

2021-04-19 Thread Ralph Mellor
On Mon, Apr 19, 2021 at 4:03 PM Andy Bach wrote: > > Very impressive and complete explanation, thanks! Thanks for that feedback, it's very helpful. I enjoy trying to help, but it's hard to ensure I've conveyed a tone of respect for whoever I'm replying to, at the same time as trying to keep thing

Re: slurpy hash signatures

2021-04-19 Thread Andy Bach
ions "Did you mean to pass ...?" From: Ralph Mellor Sent: Sunday, April 18, 2021 11:59 PM To: Joseph Brenner Cc: perl6-users Subject: Re: slurpy hash signatures CAUTION - EXTERNAL: On Sun, Apr 18, 2021 at 8:00 PM Joseph Brenner wrote: > > Before I get started here, a smal

Re: slurpy hash signatures

2021-04-18 Thread Ralph Mellor
On Sun, Apr 18, 2021 at 8:00 PM Joseph Brenner wrote: > > Before I get started here, a small point about defining hashes. > There are various ways that work: > >my %h1 = ( 'ha' => 1, 'ho' => 2, 'hum' => 3 ); >my %h2 = ( ha => 1, ho => 2, hum => 3 ); >my %h3 = ha => 1, ho => 2, h

Re: slurpy hash signatures

2021-04-18 Thread Joseph Brenner
Bruce Gray points out that this is one of the known traps: https://docs.raku.org/language/traps#Named_parameters I gather there's some sort of special-casing going on where you might think that named arguments are exactly the same a list of pairs, but that's not precisely what's going on, and r

Re: slurpy hash signatures

2021-04-18 Thread yary
On Sun, Apr 18, 2021 at 3:00 PM Joseph Brenner wrote: > Before I get started here, a small point about defining hashes. > There are various ways that work: > > my %h1 = ( 'ha' => 1, 'ho' => 2, 'hum' => 3 ); > my %h2 = ( ha => 1, ho => 2, hum => 3 ); > my %h3 = ha => 1, ho =>

slurpy hash signatures

2021-04-18 Thread Joseph Brenner
re's this: multi method new(*%attrinit) { And here in an article by Elizabeth Mattijsen I see: https://opensource.com/article/18/9/signatures-perl-6 If you want to catch any (other) named arguments, you can use a so-called "slurpy hash." Just like the slurpy array,

Re: slurpy hash

2010-08-18 Thread John Harrison
One thing also worth noting is that $1 is an alias to $/[1]. perl6 > my $1 = 2; say $1; 2 > my $1 = 2; say $/[1]; 2 Also, $ is an alias to $/. This would make them rather difficult to use in parameters, IMO. -- John Harrison On Wed, Aug 18, 2010 at 3:12 AM, Moritz Lenz wrote: > > > Am 18.0

Re: slurpy hash

2010-08-18 Thread Moritz Lenz
Am 18.08.2010 01:33, schrieb Darren Duncan: David H. Adler wrote: Hm. So how are valid parameter names defined? Identifiers in perl6 seem to be composed of letters, digits and underscores (and hyphens and apostrophes between letters). That's correct. Are parameter names defined differently

Re: slurpy hash

2010-08-17 Thread Darren Duncan
David H. Adler wrote: Hm. So how are valid parameter names defined? Identifiers in perl6 seem to be composed of letters, digits and underscores (and hyphens and apostrophes between letters). Are parameter names defined differently? You certainly seem to be able to declare a variable $1. I belie

Re: slurpy hash

2010-08-16 Thread David H. Adler
On Mon, Aug 16, 2010 at 03:49:52PM -0400, Will Coleda wrote: > On Mon, Aug 16, 2010 at 3:36 PM, David H. Adler wrote: > > On Mon, Aug 16, 2010 at 03:14:28PM -0400, Will Coleda wrote: > >> On Mon, Aug 16, 2010 at 3:03 PM, David H. Adler wrote: > >> > Given the code: > >> > > >> > ? ? ? ?use v6; >

Re: slurpy hash

2010-08-16 Thread Will Coleda
On Mon, Aug 16, 2010 at 3:36 PM, David H. Adler wrote: > On Mon, Aug 16, 2010 at 03:14:28PM -0400, Will Coleda wrote: >> On Mon, Aug 16, 2010 at 3:03 PM, David H. Adler wrote: >> > Given the code: >> > >> > ? ? ? ?use v6; >> > >> > ? ? ? ?sub speakhash (*%hash) { >> > ? ? ? ? ? ?say "%hash{}"; >>

Re: slurpy hash

2010-08-16 Thread David H. Adler
On Mon, Aug 16, 2010 at 03:14:28PM -0400, Will Coleda wrote: > On Mon, Aug 16, 2010 at 3:03 PM, David H. Adler wrote: > > Given the code: > > > > ? ? ? ?use v6; > > > > ? ? ? ?sub speakhash (*%hash) { > > ? ? ? ? ? ?say "%hash{}"; > > ? ? ? ?} > > > > ? ? ? ?speakhash(1, 2, 3, 4, 5, 6); > > > > I

Re: slurpy hash

2010-08-16 Thread Will Coleda
On Mon, Aug 16, 2010 at 3:03 PM, David H. Adler wrote: > Given the code: > >        use v6; > >        sub speakhash (*%hash) { >            say "%hash{}"; >        } > >        speakhash(1, 2, 3, 4, 5, 6); > > I get the error: > >        Too many positional parameters passed; got 6 but expected 0

slurpy hash

2010-08-16 Thread David H. Adler
Given the code: use v6; sub speakhash (*%hash) { say "%hash{}"; } speakhash(1, 2, 3, 4, 5, 6); I get the error: Too many positional parameters passed; got 6 but expected 0 in 'speakhash' at line 3:slurphash.p6 in main pr