Re: Vectorizing operators for Hashes

2002-10-31 Thread Me
%a ^:union[op] %b %a :foo[op]:bar %b I think that any operators over 10 characters should be banished, and replaced with functions. I'd agree with that. In fact probably anything over 4, and even 4 is seriously pushing it. I'll clarify that I am talking here about using

Re: Vectorizing operators for Hashes

2002-10-31 Thread Markus Laire
On 31 Oct 2002 at 0:40, John Williams wrote: On Wed, 30 Oct 2002, Me wrote: %a ^:union[op] %b %a :foo[op]:bar %b I think that any operators over 10 characters should be banished, and replaced with functions. I don't think there should be any upper limit for operator-lengths.

Re: Vectorizing operators for Hashes

2002-10-31 Thread fearcadi
Uri Guttman writes: %hash1.values [+]= %hash2{%hash1.keys} ; but here is exactly example analogous to my Dog $x = new Dog . which was discusse dand turned to my Dog $x .= new ; It's (almost) clear what you want when you write %hash1 [+]= %hash2 ; so why to screen the

Re: Vectorizing operators for Hashes

2002-10-31 Thread fearcadi
Me writes: %a ^:union[op] %b %a :foo[op]:bar %b I think that any operators over 10 characters should be banished, and replaced with functions. I agree. But I think that we can get away here with just hash properties , just like hash behaviour in regexps is

Re: Vectorizing operators for Hashes

2002-10-31 Thread Larry Wall
On Thu, 31 Oct 2002, Markus Laire wrote: : I don't think there should be any upper limit for operator-lengths. There will never be any official limits. Perl is not about arbitrary limits. But I will tell you that I only added = to Perl 5 because I knew there would never be a == operator. We'll

Re: Vectorizing operators for Hashes

2002-10-31 Thread fearcadi
Austin Hastings writes: --- [EMAIL PROTECTED] wrote: I agree. But I think that we can get away here with just hash properties , just like hash behaviour in regexps is controlled by properties . e.g. union: (%a,%b) ^is no_strict_keys ; (%a %b) ^is default_value

Re: Vectorizing operators for Hashes

2002-10-31 Thread fearcadi
Austin Hastings writes: but I am not shure ... sure thanks . sorry that I write so badly . I'll try to be better . (Unless you do this on purpose :-) Cheers, =Austin __ Do you Yahoo!? HotJobs - Search new jobs

Re: Vectorizing operators for Hashes

2002-10-31 Thread fearcadi
Me writes: union: intersection : How would this work for hashes with differing properties? %a ^is strict_keys; %b ^is no_strict_keys; What would happen? in the resulting hash only ( and all ) keys of %a will be present. because %b *admits* unknown keys but %a

Re: Vectorizing operators for Hashes

2002-10-31 Thread fearcadi
Larry Wall writes: On Thu, 31 Oct 2002, Me wrote: : That's one reason why I suggested control of this sort : of thing should be a property of the operation, not of : the operands. I think that by and large, the operator knows whether it wants to do union or intersection. When

Re: Vectorizing operators for Hashes

2002-10-31 Thread Me
On Thu, 31 Oct 2002, Me wrote: : That's one reason why I suggested control of this sort : of thing should be a property of the operation, not of : the operands. I think that by and large, the operator knows whether it wants to do union or intersection. When you're doing +, it's obviously

Re: Vectorizing operators for Hashes

2002-10-31 Thread fearcadi
Me writes: union: intersection : %a ^is strict_keys; %b ^is no_strict_keys; in the resulting hash only ( and all ) keys of %a will be present. because %b *admits* unknown keys but %a does not. Yes, but the general case is that one wants to be

Re: Vectorizing operators for Hashes

2002-10-31 Thread Austin Hastings
--- Larry Wall [EMAIL PROTECTED] wrote: On Thu, 31 Oct 2002, Markus Laire wrote: The really great thing about the French quotes is that they visually keep the user aware of the composition. «+=» is obviously a variety of +=, whereas ^+= is not obvious, though shorter. (Square brackets are

Re: Vectorizing operators for Hashes

2002-10-30 Thread fearcadi
Proposal : Vector operations for Hashes %a ^{+} %b the direct generalization would be as follows : a ^[op] b for a ; b - $x ; $y { $x op $y } %a op %b # find common keys k = keys hash{ map { { _=1 } } *( %a.keys , %b.keys ) }; #return hash

Re: Vectorizing operators for Hashes

2002-10-30 Thread Larry Wall
On Wed, 30 Oct 2002 [EMAIL PROTECTED] wrote: : # find common keys : @k = keys hash{ map { { _=1 } } *( %a.keys , %b.keys ) }; It seems a bit odd to privilege the intersection over the union. Larry

Re: Vectorizing operators for Hashes

2002-10-30 Thread fearcadi
!! Sorry, in previos post I had a mistake Proposal : Vector operations for Hashes ( this is just a joke %a ^{+} %b ) the direct generalization would be as follows : a ^[op] b for a ; b - $x ; $y { $x op $y } %a ^[op] %b # find

Re: Vectorizing operators for Hashes

2002-10-30 Thread fearcadi
So is it usefull to make sence out of these : hash ^[op] hash hash ^[op] array hash ^[op] scalar array ^[op] array array ^[op] scalar Actually , I just want to understand , why so much accent is put on vectorizing atomic operations with arrays . It seems that hashes are at least as

Re: Vectorizing operators for Hashes

2002-10-30 Thread Me
hash ^[op] hash ... array ^[op] scalar ie, generally: term ^[op] term what to do if a, b in a ^[op] b have different length what to do if %a, %b in %a ^[op] %b have not the same set of keys what to do in %a ^[op] a [what to do] resolved by hash property : I'd expect adverbs

Re: Vectorizing operators for Hashes

2002-10-30 Thread Uri Guttman
fc == [EMAIL PROTECTED] writes: fc So is it usefull to make sence out of these : fc hash ^[op] hash fc hash ^[op] array fc hash ^[op] scalar fc array ^[op] array fc array ^[op] scalar well, you can't mung the keys to a hash, just the values. so why not just use the values

Re: Vectorizing operators for Hashes

2002-10-30 Thread John Williams
On Wed, 30 Oct 2002, Me wrote: %a ^:union[op] %b %a :foo[op]:bar %b I think that any operators over 10 characters should be banished, and replaced with functions. ~ John Williams