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_forcount 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 ..

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 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

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' in

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 is modified?

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 be for

Re: Simple Print/Say Question

2006-05-24 Thread Daniel Hulme
Wrt your second problem, if this $arg_forarray = [ ( 0 .. $arg_forcount ) »*« $arg_forscale ]; 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

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_for is

Re: Simple Print/Say Question

2006-05-24 Thread A. Pagaltzis
* Daniel Hulme [EMAIL PROTECTED] [2006-05-24 12:45]: $arg_forarray = [ ( 0 .. $arg_forcount ) »*« $arg_forscale ]; 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: | |

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) since we are

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 $scale. If that is

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 consisting of $count

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 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; Yes, I

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, }, snip ); for %buckets.values - $arg_for { $arg_forarray

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, both of

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 understanding,

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 postfix

Simple Print/Say Question

2006-05-23 Thread Chris Yocum
Hi all, I was converting a program that I wrote a while back from Perl5 to Perl6 and I got stuck on something really easy. In Perl5, when I want to print something out, in this case an array with lines between the columns, like this: 1|2|3 I would say something like: print $array[0] . | .

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 | | | My

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 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 that!

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

Re: Simple Print/Say Question

2006-05-23 Thread Ovid
://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 just tried this using an old version (6.2.3) of Pugs

Re: Simple Print/Say Question

2006-05-23 Thread Chris Yocum
: 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 just tried this using an old version (6.2.3) of Pugs: my (@array) = 1,2,3; print @array[0] ~ | ~ @array[1

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 some

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 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 nested

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
- 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_forcount for constant subscripts. Thanks! The revised script is below for those who are interested. Cheers, Ovid - my %buckets = (