in reply to perl6 custom operator problem
Uses "Lazy lists" and the Zip (Z) operator.my %to_num = map { $_[0]=> 10**$_[1] }, (qw|pico nano micro milli centi hecto kilo mega giga tera| Z (-12, {$_+3}... -3,-2,2,3,{$_+3}... 12)) ;
I'm still learning p6, and I agree - there HAS to be a better way to avoid all that boilerplate code, so I'll keep a watch for responses.
...it is unhealthy to remain near things that are in the process of blowing up. man page for WARP, by Larry Wall
|
|---|