On Fri, 16 Apr 2004, Aaron Sherman wrote:
> > > @matrix... = <<1 0 0 1>>;
>
> In the case of:
>
> @matrix = <<1 2 3 4 5>>;
>
> You need only add the type:
>
> int @matrix = <<1 2 3 4 5>>;
> There is no string phase, or at least should never be.
> The compiler can
> pre-compute the
On Thu, 2004-04-15 at 18:23, Austin Hastings wrote:
> > @matrix... = <<1 0 0 1>>;
> Keep in mind that you're using a quoting operator. For numbers, you can just
> use (0, 1, 2, 3)
> and probably be better understood. (The <> approach will
> work, but it will take all the numbers through a str
Austin Hastings writes:
>
>
> > -Original Message-
> > From: Abhijit A. Mahabal [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, 15 April, 2004 05:13 PM
> > To: [EMAIL PROTECTED]
> > Subject: Array/Hash Slices, multidimensional
> >
> >
> > As the hash syntax is being worked out, I thought it
> -Original Message-
> From: Abhijit A. Mahabal [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 15 April, 2004 05:13 PM
> To: [EMAIL PROTECTED]
> Subject: Array/Hash Slices, multidimensional
>
>
> As the hash syntax is being worked out, I thought it'd be a good time to
> ask if the following
> [run time control of assignment behavior when array contains pairs]
How much have I misunderstood things from a mechanisms
available point of view (as against a practical / nice way to
do things) when I suggest something along the lines of:
my sub op:= (*@list : %adverbs) {
...
At 8:48 AM -0600 9/3/02, Luke Palmer wrote:
> > Hmm... I think I'd rather see
>>
>>my $foo is Bag = @array.as('Bag');
>>
>> The idea being that one could treat hashes and arrays as syntactic
>> vitamins meaning 'Dictionary' (to use the Smalltalk term) and
>> 'OrderedCollection', but all Co
> Hmm... I think I'd rather see
>
> my $foo is Bag = @array.as('Bag');
>
> The idea being that one could treat hashes and arrays as syntactic
> vitamins meaning 'Dictionary' (to use the Smalltalk term) and
> 'OrderedCollection', but all Collections would implement an C
> method allowing conve
Damian Conway <[EMAIL PROTECTED]> writes:
> Uri Guttman wrote:
>
>> but what simon was saying (and i agree) is the the pair IS a single
>> item. it becomes the key and its value is 'scalars'.
>
> No. If it's a PAIR, then its key is the key and its value is the value.
>
>
>> hashes can now take ob
David Whipp <[EMAIL PROTECTED]> writes:
> Piers Cawley wrote:
>> Maybe we should just say 'sod it' and implement the entire Smalltalk
>> Collection hierarchy and have done with it? Sets, bags, hashes
>> (dictionaries for the Smalltalker), whatever, all have their uses...
>
> I'm not sure if you w
Uri Guttman <[EMAIL PROTECTED]> writes:
>> "SC" == Simon Cozens <[EMAIL PROTECTED]> writes:
>
> SC> [EMAIL PROTECTED] (Damian Conway) writes:
> >> > hashes can now take objects as keys and won't just stringify them.
> >>
> >> Correct. But I believe that's only if the hash has a prope
Uri Guttman wrote:
> but what about mixing pairs and scalars which was the core of this
> thread?
Then you get whatever behaviour you defined the hash to give.
> by default it seems assigning such a list to a hash would use
> the pairs as 2 elements
It's not the right way to think about wha
> "DC" == Damian Conway <[EMAIL PROTECTED]> writes:
DC> Uri Guttman wrote:
>> so what that attribute does is force the hash to keep all pairs as
>> single objects. but what about run time control of it? sometimes you
>> might want a list of pairs to be handled like pairs and other tim
Uri Guttman wrote:
> so what that attribute does is force the hash to keep all pairs as
> single objects. but what about run time control of it? sometimes you
> might want a list of pairs to be handled like pairs and other times you
> want pairs to be scalars in a hash assignment. is there any wa
> "SC" == Simon Cozens <[EMAIL PROTECTED]> writes:
SC> [EMAIL PROTECTED] (Damian Conway) writes:
>> > hashes can now take objects as keys and won't just stringify them.
>>
>> Correct. But I believe that's only if the hash has a property that marks
>> its keys as being objects, not
[EMAIL PROTECTED] (Damian Conway) writes:
> > hashes can now take objects as keys and won't just stringify them.
>
> Correct. But I believe that's only if the hash has a property that marks
> its keys as being objects, not strings:
>
> my %hash is keyed(REF);
>
> And, even if that's the d
Uri Guttman wrote:
> but what simon was saying (and i agree) is the the pair IS a single
> item. it becomes the key and its value is 'scalars'.
No. If it's a PAIR, then its key is the key and its value is the value.
> hashes can now take objects as keys and won't just stringify them.
Correct.
> "KF" == Ken Fox <[EMAIL PROTECTED]> writes:
KF> Simon Cozens wrote:
>> [EMAIL PROTECTED] (Damian Conway) writes:
>>
%hash4 = ("Something", "mixing", pairs => and, "scalars");
>>>
>>> That's perfectly okay (except you forgot the quotes around the
>>> and you have an odd
Simon Cozens wrote:
> [EMAIL PROTECTED] (Damian Conway) writes:
>
>>> %hash4 = ("Something", "mixing", pairs => and, "scalars");
>>
>>That's perfectly okay (except you forgot the quotes around the
>>and you have an odd number of elements initializing the hash).
>
> Urgh, no. Either a pair is a
[EMAIL PROTECTED] (Damian Conway) writes:
> > %hash4 = ("Something", "mixing", pairs => and, "scalars");
>
> That's perfectly okay (except you forgot the quotes around the
> and you have an odd number of elements initializing the hash).
Urgh, no. Either a pair is an atomic entity or it isn't.
Nicholas Clark asked:
>%hash3 = @kv_array
>
> Is perl6 going to spot that @kv_array has an even number of entries, all
> are scalars (no pairs), and so do this
>
>for @kv_array -> key, value {
>%hash3{$key} = $value;
>}
Yes. Just like in Perl 5.
> Or is it going to treat
From: "Nicholas Clark" <[EMAIL PROTECTED]>
> In Damian's excellent perl6 talk, I think he said that by default a hash
> in list context will return a list of pairs. Hence this
>
>@array = %hash
>
> for %hash with n keys would give an array of n elements, all pairs.
Will there actually be a
Piers Cawley wrote:
> Maybe we should just say 'sod it' and implement the entire Smalltalk
> Collection hierarchy and have done with it? Sets, bags, hashes
> (dictionaries for the Smalltalker), whatever, all have their uses...
I'm not sure if you were being facetious, but I do think all the
funct
Steffen Mueller
> > %hash4 = ("Something", "mixing", pairs => and, "scalars");
>1 23 4 5
> Perl5 says "Odd number of elements in hash assignment at -e line 1."
> And Perl6 should, too.
Hmm, I rather like the idea of thinking of a %foo variable as
[EMAIL PROTECTED] (Steffen Mueller) writes:
> > %hash4 = ("Something", "mixing", pairs => and, "scalars");
>1 23 4 5
> Perl5 says "Odd number of elements in hash assignment at -e line 1."
> And Perl6 should, too.
Except that a pair is a single th
Nicholas Clark wrote:
[...]
> And what happens if I write
>
> %hash4 = ("Something", "mixing", pairs => and, "scalars");
1 23 4 5
Perl5 says "Odd number of elements in hash assignment at -e line 1."
And Perl6 should, too.
IMHO, your example isn't
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
47 matches
Mail list logo