in reply to Schwartzian Transform
over this:my @output = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_, expensive_func($_)] } @input;
foreach $_ (@input) { $result_for{$_} = expensive_func($_); } my @output = sort { $result_for{$a} cmp $result_for{$b} } @input;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Schwartzian Transform vs. Building Hash of Function Results, Then Sorting on Function Results
by merlyn (Sage) on Oct 16, 2006 at 19:27 UTC | |
Re: Schwartzian Transform vs. Building Hash of Function Results, Then Sorting on Function Results
by Limbic~Region (Chancellor) on Oct 16, 2006 at 19:10 UTC | |
by davebaker (Pilgrim) on Oct 16, 2006 at 19:35 UTC |