On Tue, 14 Jun 2005 07:19:09 -0700, Mark A. Biggar <[EMAIL PROTECTED]> wrote:
> Luke Palmer wrote:
>> On 14 Jun 2005 06:07:10 -0000, David Formosa (aka ? the Platypus)
>> <[EMAIL PROTECTED]> wrote:

>>>multi sub infix_circumfix_meta_operator:{'>>','<<'} (Hash %a,Hash %b,Code 
>>>$op) {
>>>        my Hash %return;
>>>        for intersection(keys %a,keys %b) -> $key {
>>>          %return{$key} = $op($a{$key},$b{$key});
>>>        }
>>>        return %return;
>>>        Would this be sensible, usefull behavour?
[...]  The difference between
>> the hyper hash ops and vector-vector ops in my class is the fact that
>> you did intersection instead of union (I assumed unset elements were
>> 0).  Unfortunately, such an assumption doesn't make sense on a general
>> scale, so I wonder whether I would end up using the hash hyper ops or
>> whether I'd just go and implement them again.
>> So, I'd really like to see a couple examples where this behavior could
>> be useful.  I don't doubt that it can, but I can't think of anything
>> at the moment.
> This is effectively the Database inner vs outer join issue.  There are 
> times you need one and times you need the other.  Example for the outer 
> join case: combining two invoices where you want to add together the 
> subtotals for each type of item and missing items on either invoice 
> should be assumed to be 0 quantity at 0 dollars.

>  Note that just like in 
> the reduce op you need to know the identity value associated with the 
> op.  come to think of it just like in the DB world you really need 4 
> different versions: inner join (intersection of keys), full outer join 
> (union of keys) and the left and right outer joins where you on consider 
> the missing keys on the left or right sides.

If you consider arrays to be hashes keyed by integers then @a >>..<<
@b does the equiverlent of an inner join.  I would suggest that if we
are going to have outer join versions then we have something like this

 >>...<<  inner joing hyperop
>>>...<<  left outer joing hyperop
 >>...<<< right outer joing hyperop
>>>...<<< full outer joing hyperop 

> This means that the current 
> hyper-op should be define to be one of inner or full and we need some 
> syntax to specify the other three op types.  >>-:left<< Ugh!

I think my syntax is slightly less ugly. 

Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.

Reply via email to