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
* 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
* 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
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
- 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;
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
"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
* 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
"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
* 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,
* 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
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
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
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
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"'
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
my %buckets = (
w => {
count => 4,
scale => 10.5,
},
x => {
count => 6,
scale => 7,
},
y => {
count => 12,
scale => 3,
},
z => {
count => 18,
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
- 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 = (
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'
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
"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."
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
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
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
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
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
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
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 | |
29 matches
Mail list logo