in reply to Re^4: Is there a more functional regex syntax?
in thread Is there a more functional regex syntax?
Some parts of List::Util are a little ill-conceived. For example, the existence of separate min and minstr functions (and max/maxstr).
Two points:
Adding uniq() would be nice if it ran more quickly than a pure perl implementation: sub uniq{ my %h; undef @h{ @_ }; keys %h }
min amd minstr run more quickly than their equivalents using reduce, because they avoid the need to callback to Perl for every item.
Sort gets away with using a callback by recognising the simple patterns of callback block {$a<=>$b} & {$a cmp $b} and bypassing them in favour of dedicate opcodes for those simple cases.
Effectively, sort{$a <=> $b } is the subroutine name. sortn would be shorter, easier to type and remember. Ditto for sorts
List::Util doesn't have that option because it is outside the core.
|
|---|