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 
hash {
        for @k -> $x { 
                { $x => %a{$x} op %b{$x} } 
        }   
     }

so in words , find coomon keys and then vectorize op as if 
hash keys are array indexes. 

Probably that behaviour may be tuned or conrolled by properties of
hashes just like what happens inside <regexes> . 

maybe this could be made more general , since 
Larry noted  that junctions ( 1 | 2 | 3 ) are similar to hashes  

> %hash = ( 1 | 2 | 3 ) ; 

dont have any Idea how. 

arcadi. 

Reply via email to