t: 07/24/2001 6:03 PM
Subject: Re: array/hash manipulation [was :what's with 'with'?]
"Sterin, Ilya" wrote:
> But now I am trying to figure out, if you are not comparing elements
of the
> array and for example if you need to loop through 3 arrays at the same
time,
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, July 21, 2001 5:50 AM
> To: Sterin, Ilya; 'raptor '; Perl 6 Language
> Subject: RE: array/hash manipulation [was :what's with 'with'?]
>
>
> "
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, July 21, 2001 5:50 AM
> To: Sterin, Ilya; 'raptor '; Perl 6 Language
> Subject: RE: array/hash manipulation [was :what's with 'with'?]
>
>
> "
"Sterin, Ilya" <[EMAIL PROTECTED]> wrote:
> Just one question, how
> would merge behave on two different sized arrays.
>
> @a = (1..5);
> @b = (1..10);
> merge(@a, @b);
>
> ##Would return (1,1,2,2,3,3,4,4,5,5,??
>
> Would it stop on the shortest array. Couldn't quite find such explanat
> -Original Message-
> From: Jeremy Howard [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 20, 2001 8:40 PM
> To: Sterin, Ilya; 'raptor '; [EMAIL PROTECTED]
> Subject: Re: array/hash manipulation [was :what's with 'with'?]
>
>
> "Ste
"Sterin, Ilya" <[EMAIL PROTECTED]> wrote:
> Hmmm. Didn't think about that. That would be a nice way, that way you can
> manipulate it's behaviour depending with how many aliases you provide.
>
> for my $el1, $el2 ( (@foo, @bar) ) {
> print "$el\n"
> }
>
> $el1 and $el2 would of course be ali
"John Porter" wrote:
> Sterin, Ilya wrote:
> > Don't really know which would be more helpful, since I first need to
find a
> > scenerio where I would use this facility, then what result would I
expect
> > once the shortest list runs out.
>
> Let us ask the PDL folks.
>
> In fact, I'm quite sure th
Sterin, Ilya wrote:
> Don't really know which would be more helpful, since I first need to find a
> scenerio where I would use this facility, then what result would I expect
> once the shortest list runs out.
Let us ask the PDL folks.
In fact, I'm quite sure this has been done already.
--
Jo
s out. Do I still need the values of the longer
list, for one reason or another, or do I want the loop aborted?
Ilya
-Original Message-
From: David L. Nicol
To: Sterin, Ilya
Cc: 'raptor '; '[EMAIL PROTECTED] '
Sent: 07/20/2001 1:44 PM
Subject: Re: array/hash manipulatio
On Friday, July 20, Ilya Sterin wrote:
>No, I don't think you are understanding it correctly. It's not about
>looping sequentially, but rather simultaneouly, for comparison purposes.
>
>@foo = (1,2,3);
>@bar = (1,2,3);
>for my ($foo, $bar) (@foo, @bar) #As the index for @foo increases, so
>
#does @bar index
{
print "OK\n" if $foo == $bar;
}
Will print...
OK
OK
OK
Ilya
-Original Message-
From: Eric Roode
To: [EMAIL PROTECTED]
Sent: 07/20/2001 11:30 AM
Subject: Re: array/hash manipulation [was :what's with 'with'?]
on Fri Jul 20, Mark REED wrote:
>I
ed
To: '[EMAIL PROTECTED] '
Sent: 07/20/2001 11:21 AM
Subject: Re: array/hash manipulation [was :what's with 'with'?]
On Fri, Jul 20, 2001 at 11:17:13AM -0600, Sterin, Ilya wrote:
> But this will be flattened, so I would think
>
> for my($key, $val)(%my_hash)
>
on Fri Jul 20, Mark REED wrote:
>I'm sorry, but I fail to see how this is a big improvement over the
>current version:
>
>while (my ($key, $val) = each %my_hash)
>{ ... }
And a workalike to
while ( ($a,$b,$c) = (@a, @b, @c) )
or
for my ($el1, $el2) (@foo, @bar)
is very e
Well, other than the fact that the while(each) doesn't do aliasing.
Since that would be the whole point, ignore that last message.
On Fri, Jul 20, 2001 at 01:21:57PM -0400, Mark J. Reed wrote:
> On Fri, Jul 20, 2001 at 11:17:13AM -0600, Sterin, Ilya wrote:
> > But this will be flattened, so I wo
ooops I forgot if the vars in for are aliesed then it will be ok for using
it like 'with' :
for my $el ( $Request->{Param} ) {
print $el{qsParam1}
print $el{qsParam2}
}
but then what will be $_ ... alias OR copy !?! :") I mean mostly backward
compatibility...
One other way is 'local' to
On Fri, Jul 20, 2001 at 11:17:13AM -0600, Sterin, Ilya wrote:
> But this will be flattened, so I would think
>
> for my($key, $val)(%my_hash)
> { ... }
>
> Would be a great convenience. $key and $val being aliased accordingly.
I'm sorry, but I fail to see how this is a big improvement over the
But this will be flattened, so I would think
for my($key, $val)(%my_hash)
{ ... }
Would be a great convenience. $key and $val being aliased accordingly.
Ilya
-Original Message-
From: raptor
To: Sterin, Ilya; [EMAIL PROTECTED]
Sent: 07/20/2001 9:10 AM
Subject: Re: array/hash manipul
> Hmmm. Didn't think about that. That would be a nice way, that way you can
> manipulate it's behaviour depending with how many aliases you provide.
>
> for my $el1, $el2 ( (@foo, @bar) ) {
> print "$el\n"
> }
>
> $el1 and $el2 would of course be aliases, right?
]- yes ALIASING will be bett
a
-Original Message-
From: raptor
To: [EMAIL PROTECTED]
Sent: 07/20/2001 3:37 AM
Subject: Re: array/hash manipulation [was :what's with 'with'?]
> So my initial code (which I modified a little...)
>
> for ( @foo, @bar ) {
> print "$_[0] : $_[1]\n";
"raptor" <[EMAIL PROTECTED]> wrote:
> but now I'm looking at these too...
> http://dev.perl.org/rfc/90.pod
> http://dev.perl.org/rfc/91.pod
> http://dev.perl.org/rfc/148.pod
>
> so may be what must be the order of passing the arguments and other stuff
> should be done via these proposed functions.
raptor wrote:
>
> for my $el1, $el2 ( @foo, @bar ) {
Hopefully you mean
for my $el1, my $el2 ( @foo, @bar ) {
or maybe
for [ my $el1, my $el2 ] ( @foo, @bar ) {
And yes, it's an old idea.
> PS. I was thinking of that before, what if we have something let's call it
> 'transform' for
> So my initial code (which I modified a little...)
>
> for ( @foo, @bar ) {
> print "$_[0] : $_[1]\n";
> }
>
> for would set each element of the @_ array to correspond to the arguments
in
> for() , therfore $_[0] will equal to the current element of @foo and $_[1]
> will equal to the correspo
22 matches
Mail list logo