Another New module on its way to CPAN

Liyang HU liyang at nerv.cx
Sat Nov 30 07:32:42 CST 2002


You can get it at:

    http://nerv.cx/liyang/perl/ForLoop-0.0.0.0.0.0.1.tar.gz

What does it do? One thing and one thing only: it takes a sub ref,
passing it a numeric value successively between two limits you specify.
e.g.:

    for_loop(1, 10, sub { print shift(). " of ten!" });

Hopefully, support for iterating over arrays will come in the next
release. Beta-testers are welcome! Please contact me for details!

...

On Wed, Nov 27, 2002 at 05:08:29PM +0000, Stray Toaster wrote:
> On Wed, Nov 27, 2002 at 04:59:27PM +0000, Jasper McCrea wrote:
> > Isn't this false laziness?

Yes.

> As opposed to me remembering to do the map bit, with the braces and
> all, I erase that from my mind and just remember merge_hashref.

Repeat after me: map is good. Erasing map from one's mind is baaaad.
Mmkay?

> For the same reason as File::Slurp.

Well, you can justify *anything* using existing modules in CPAN...
genocide, probably. I'm getting a distinct feeling somewhat akin to the
freshmeat ``My First Shell Script'' syndrome... asserting copyright and
specifying the license for one line of code is just silly[0].

How about actually merging hashes (dealing with key clashes), like the
module's name suggests it ought to do? Something like:

    my $ref = merge_hashref(sub { my ($a, $b) = @_;
        return $a > $b ? $a : $b }, $ref1, $ref2, ...);

later,
/Liyang
[0] Not that I'm saying one shouldn't be able to...
-- 
.--{ Liyang HU }--{ http://nerv.cx/ }--{ Caius at Cam }--{ PGP: 7B632CB8 }--.
| I'm sure you've written down every 216 digit number, you've translated |
| all of them, you've intoned them all. Haven't you?    -- Max Cohen, Pi |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 218 bytes
Desc: not available
Url : http://mail.pm.org/archives/belfast-pm/attachments/20021130/6c07e8b1/attachment.bin


More information about the Belfast-pm mailing list