ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Re: %hash1 >>...<< %hash2
by Luke Palmer other posts by this author
Jun 14 2005 6:40AM messages near this date
Re: Binding slices | Re: %hash1 >>...<< %hash2
On 14 Jun 2005 06:07:10 -0000, David Formosa (aka ? the Platypus)
<dformosa@[...].au>  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
Thread:
Luke Palmer
Brent 'Dax' Royal-Gordon
Larry Wall
Mark A. Biggar

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved