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?

I think so.

In fact, I've implemented "hash vector" and "hash matrix" classes
which are useful for doing various linearesque things, when you don't
know how many elements your vectors will have.  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.

Luke

Reply via email to