Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You can reduce the complexity in the TOP reduction method by preparing ASTs in the reduction methods of the previous rules (read that backwards to get the actual order of execution):
You could also try to stuff all the complexity in method TOP, and use meta operators and parallel dispatch to replace the loop, but I think it will be harder to write, read and debug. Still here's an untested suggestion:
since the hash indexing with .<key> is just a method call, it can be applied to all items in an array or list with <c>».</code> parallel dispatch (or >>. if you are an ASCII fan). Z=> is the Zip meta operator with the => pair constructor. It takes an item from each list, constructs a pair from them, then takes the second item from each list etc.
Perl 6 - links to (nearly) everything that is Perl 6.
In reply to Re: P6: grammar: create a hash instead of array?
by moritz
|
|