> 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
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
"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.
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?
But one though might be, what happens if
Please sign me off.
Alice
> 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
My only concern is with hashes, since they come in no particular order
unless sorted, there probably would not be any use to iterate over the
values of more than one hash? At least I can't think of any use. But it
would be nice to iterate over one hash, like so...
for (%my_hash)
{ ... }
But th
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
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
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
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
It's really not an improvement, but rather a comment, since if aliases and
iterations for numerous arrays were implemented, they would of course have
to somehow behave with hashes, so this would be a bahavior that could be
implemented.
Ilya
-Original Message-
From: Mark J. Reed
To: '[EMA
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
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
>
But how would you then copy, without having to bring the reference in
existance first. How would you copy period? Maybe I am not understanding,
hopefully someone can clear it up:)
Ilya
-Original Message-
From: David L. Nicol
To: Mark J. Reed
Cc: '[EMAIL PROTECTED] '
Sent: 07/20/2001 1:
Right it can either stop as the shortest list iteration is done, or just set
the corresponding alias to undef.
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. Do
David L. Nicol wrote:
> Assignment to a nonexistent reference becomes an
> alias instead of a copy.
Uh, I dunno. Like Python/Ruby, but without the consistency.
I think special constructs -- defined as NOT doing assignment
-- should be allowed to set up aliases. This includes, e.g. for().
P
David L. Nicol wrote:
> No, that does not work:
Right; I misunderstood what was wanted.
--
John Porter
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
David L. Nicol wrote:
>
>Are there really situations where
>
> $$reference = An Expression;
>
>is clearer than
>
> $reference = \(An Expression);
>
>?
Eric is confused. I don't know about in Perl 6-to-be, but in Perl 5
those two mean totally different things:
$foo = \$bar;
"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" <[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
> -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'?]
>
>
> "Sterin, Ilya" <[EMAIL PROTECTED]> wrote:
> > Hmmm. Didn't
23 matches
Mail list logo