Re: Simple Print/Say Question

2006-05-24 Thread Larry Wall
On Wed, May 24, 2006 at 11:43:59AM +0100, Daniel Hulme wrote: : shouldn't the >>*<< be >>* as the right-hand operand is a scalar?), then It used to be like that once upon a time, but we later changed it so infix operators are always written with "hypers" on both sides, and only the prefix and post

Re: Simple Print/Say Question

2006-05-24 Thread A. Pagaltzis
* Steffen Schwigon <[EMAIL PROTECTED]> [2006-05-24 15:05]: > "A. Pagaltzis" <[EMAIL PROTECTED]> writes: > > Err I think you misread my mail. I meant that the code > > modifies the hash, but does nothing to modify the reference, > > so there is no need to make the reference read-write. > > In my un

Re: Simple Print/Say Question

2006-05-24 Thread A. Pagaltzis
* Ovid <[EMAIL PROTECTED]> [2006-05-24 18:00]: > First off, thanks to Aristotle for clearing some of my > thinking. NP, it’s a good way for me to pick up the disparate Perl 6 clues I picked up haphazardly over time, too. > In my version of Pugs (6.2.11 (r10390)), that fails for two > reasons, bot

Re: Simple Print/Say Question

2006-05-24 Thread Ovid
First off, thanks to Aristotle for clearing some of my thinking. - Original Message From: A. Pagaltzis <[EMAIL PROTECTED]> >my %buckets = ( >w => { >count => 4, >scale => 10.5, > }, >); > >for %buckets.values -> $arg_for { >$ar

Re: Simple Print/Say Question

2006-05-24 Thread Ovid
- Original Message From: Jonathan Scott Duff <[EMAIL PROTECTED]> > pushes an array reference onto @results (rather than things that are > int). If you're going to type @results, maybe it needs to be: > > my @results is Array of Array of int; > > or maybe > > my Array of int @results;

Re: Simple Print/Say Question

2006-05-24 Thread Jonathan Scott Duff
My two cents ... On Wed, May 24, 2006 at 10:52:29AM +0200, A. Pagaltzis wrote: > my int @results; The above line says that @results is an array of integers, but ... > @results.push( [$i, $j, $k, $l] ); pushes an array reference onto @results (rather than things that are int). If you're

Re: Simple Print/Say Question

2006-05-24 Thread Steffen Schwigon
"A. Pagaltzis" <[EMAIL PROTECTED]> writes: > * Steffen Schwigon <[EMAIL PROTECTED]> [2006-05-24 13:55]: >> "A. Pagaltzis" <[EMAIL PROTECTED]> writes: >> > * Martin Kjeldsen <[EMAIL PROTECTED]> [2006-05-24 12:25]: >> >> I understand this as the hash entry with key 'array' get >> >> assigned a array

Re: Simple Print/Say Question

2006-05-24 Thread A. Pagaltzis
* Steffen Schwigon <[EMAIL PROTECTED]> [2006-05-24 13:55]: > "A. Pagaltzis" <[EMAIL PROTECTED]> writes: > > * Martin Kjeldsen <[EMAIL PROTECTED]> [2006-05-24 12:25]: > >> I understand this as the hash entry with key 'array' get > >> assigned a array consisting of $count number multiplied by > >> $s

Re: Simple Print/Say Question

2006-05-24 Thread Steffen Schwigon
"A. Pagaltzis" <[EMAIL PROTECTED]> writes: > * Martin Kjeldsen <[EMAIL PROTECTED]> [2006-05-24 12:25]: >> I understand this as the hash entry with key 'array' get >> assigned a array consisting of $count number multiplied by >> $scale. If that is right, we must be modifying $arg_for >> (%buckets) s

Re: Simple Print/Say Question

2006-05-24 Thread A. Pagaltzis
* Daniel Hulme <[EMAIL PROTECTED]> [2006-05-24 12:45]: > > $arg_for = [ ( 0 .. $arg_for ) »*« $arg_for ]; > > btw, shouldn't the >>*<< be >>* as the right-hand operand is a > scalar? I don’t know. S03 says: | If either argument is insufficiently dimensioned, Perl | "upgrades" it: | | (3,8,

Re: Simple Print/Say Question

2006-05-24 Thread A. Pagaltzis
* Martin Kjeldsen <[EMAIL PROTECTED]> [2006-05-24 12:25]: > I understand this as the hash entry with key 'array' get > assigned a array consisting of $count number multiplied by > $scale. If that is right, we must be modifying $arg_for > (%buckets) since we are adding an entry to the hash. $arg_fo

Re: Simple Print/Say Question

2006-05-24 Thread Daniel Hulme
Wrt your second problem, if this > $arg_for = [ ( 0 .. $arg_for ) »*« $arg_for ]; is not rw so is not actually adding the entry to the hash (btw, shouldn't the >>*<< be >>* as the right-hand operand is a scalar?), then it is possible that > > > And then I get an error telling me 'No such method in

Re: Simple Print/Say Question

2006-05-24 Thread Martin Kjeldsen
Hi Aristotle, A. Pagaltzis (12:12 2006-05-24): > Hi Martin, > > * Martin Kjeldsen <[EMAIL PROTECTED]> [2006-05-24 11:50]: > > Just curious does this actually run? I'm trying on pugs 6.2.11 > > and it complains quite a bit. First of all shouldn't > > > > for %buckets.values -> $arg_for > > > > b

Re: Simple Print/Say Question

2006-05-24 Thread A. Pagaltzis
Hi Martin, * Martin Kjeldsen <[EMAIL PROTECTED]> [2006-05-24 11:50]: > Just curious does this actually run? I'm trying on pugs 6.2.11 > and it complains quite a bit. First of all shouldn't > > for %buckets.values -> $arg_for > > be > > for %buckets.values -> $arg_for is rw > > since $arg_for

Re: Simple Print/Say Question

2006-05-24 Thread Martin Kjeldsen
Just curious does this actually run? I'm trying on pugs 6.2.11 and it complains quite a bit. First of all shouldn't for %buckets.values -> $arg_for be for %buckets.values -> $arg_for is rw since $arg_for is modified? And then I get an error telling me 'No such method in class Scalar: "&kv"'

Re: Simple Print/Say Question

2006-05-24 Thread Chris Yocum
Hi Everyone, I never thought that my little script would get such loving attention least of all from such distinguished members of the community. It took me a little while to understand exactly what was going on but now that I do, it looks very good. Thank you again! It has been very ins

Re: Simple Print/Say Question

2006-05-24 Thread A. Pagaltzis
my %buckets = ( w => { count => 4, scale => 10.5, }, x => { count => 6, scale => 7, }, y => { count => 12, scale => 3, }, z => { count => 18,

Re: Simple Print/Say Question

2006-05-24 Thread Larry Wall
You should not need "my" on the right side of a ->. Also, you should be able to write $arg_for for constant subscripts. Larry On Tue, May 23, 2006 at 05:32:22PM -0700, Ovid wrote: : Er, and the first loop is better written as this: : : for %buckets.values -> my $arg_for { : for 0 .. $ar

Re: Simple Print/Say Question

2006-05-23 Thread Ovid
- Original Message > From: Larry Wall <[EMAIL PROTECTED]> > > You should not need "my" on the right side of a ->. Also, you should > be able to write $arg_for for constant subscripts. Thanks! The revised script is below for those who are interested. Cheers, Ovid - my %buckets = (

Re: Simple Print/Say Question

2006-05-23 Thread Ovid
Er, and the first loop is better written as this: for %buckets.values -> my $arg_for { for 0 .. $arg_for{'count'} -> $index { $arg_for{'array'}.push($index * $arg_for{'scale'}); } } Instead of: for %buckets.kv -> my $bucket, $arg_for { for 0 .. $arg_for{'count'

Re: Simple Print/Say Question

2006-05-23 Thread Ovid
Hi Chris, I hope you don't mind. With the idea of getting back into Perl6, I've taken the liberty of rewriting your code to clean it up a bit (somewhat successfully), and make it more "perl6ish" (somewhat unsuccessfully). The only significant issue I have with my version is the terribly neste

Re: Simple Print/Say Question

2006-05-23 Thread Dr.Ruud
"Chris Yocum" schreef: > print @array[0] ~ "|" ~ @array[1] ~ "|" ~ @array[2] . "\n"; First the Perl6-equivalent of $" = '|' ; and then say "@array" ; -- Affijn, Ruud "Gewoon is een tijger."

Re: Simple Print/Say Question

2006-05-23 Thread Chris Yocum
Dear Mr. Bach, You were indeed correct so I wrapped the %hash like this "@{%hash}" like you would to de-refrence an array and it worked perfectly. It was indeed just me. Thanks to everyone that responded! Chris On 5/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Oh, I just saw som

Re: Simple Print/Say Question

2006-05-23 Thread Chris Yocum
st, please send follow up questions to the list. Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/ - Original Message From: Fagyal Csongor <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: perl6-users@perl.org Sent: Tuesday, May 23, 2006 12:11:07 PM Subject: Re: Simple Print

Re: Simple Print/Say Question

2006-05-23 Thread Ovid
ist. Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/ - Original Message From: Fagyal Csongor <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: perl6-users@perl.org Sent: Tuesday, May 23, 2006 12:11:07 PM Subject: Re: Simple Print/Say Question Chris, Strange. I have j

Re: Simple Print/Say Question

2006-05-23 Thread Chris Yocum
Dear Fagyal, Huh. Strange. I tried the code on its own without the rest of the script and it did just fine as well. There must be something wrong in my script somewhere. Chris On 5/23/06, Fagyal Csongor <[EMAIL PROTECTED]> wrote: Chris, Strange. I have just tried this using an old versi

Re: Simple Print/Say Question

2006-05-23 Thread Fagyal Csongor
Chris, Strange. I have just tried this using an old version (6.2.3) of Pugs: my (@array) = 1,2,3; print @array[0] ~ "|" ~ @array[1] ~ "|" ~ @array[2] ~ "\n"; It prints 1|2|3 on my terminal. Gabor's join-ed version also works. - Fagzal > Oops. That last . is a typo on my part. Sorry about th

Re: Simple Print/Say Question

2006-05-23 Thread Chris Yocum
Oops. That last . is a typo on my part. Sorry about that! It should read, which it does in my code: print @array[0] ~ "|" ~ @array[1] ~ "|" ~ @array[2] ~ "\n"; However, your say join technique does not work. I will keep on it but for now I am off to dinner! Thanks!, Chris On 5/23/06, Gabor

Re: Simple Print/Say Question

2006-05-23 Thread Gabor Szabo
On 5/23/06, Chris Yocum <[EMAIL PROTECTED]> wrote: 1|2|3 I would say something like: print $array[0] . "|" . $array[1] . "|" . $array[2] . "\n"; not the best way but it works. In Perl6 if say something like this: print @array[0] ~ "|" ~ @array[1] ~ "|" ~ @array[2] . "\n"; I get 1 2 3 | |