TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Underscore Perl

3 pointsby zeeonealmost 14 years ago

1 comment

jerfalmost 14 years ago
This is... not useful. Perl doesn't have a (weak) functional-programming gap that needs fixing that badly in the first place. The big clue should have been when map had to be defined in terms of... map. Perl's map can be used directly to do the vast bulk of things in that file:<p><pre><code> # reducing; folding is obvious from here my $accum = 0; map { $accum += $_ } @nums; # filter map { $_ ? ($_) : () } @list; # also grep, of course, but if you want to filter and # do other things it's useful # flattening map { @$_ } @arrayrefs; </code></pre> For the rest, just look at the source code and observe, for instance, the pointless wrapping of List::Utils::uniq for unique. Far more idiomatic or established ways of doing all (or almost all, with the remainder being easily fixed up from CPAN) these things exist in the core shipped modules. The actual use of this library is almost certain to be both klunkier <i>and</i> less idiomatic and readable than what Perl ships with out of the box.<p>Underscore is not the <i>sine qua non</i> of weak functional programming.
评论 #2871638 未加载
评论 #2876191 未加载