Posts filed under “perl”

CPAN updates

I recently posted some things to Perl’s CPAN that I’ve previously discussed in this blog. After my post on AUTOLOAD hate, I released the module discussed in it as Sub::Auto. I finally released Attribute::Cached briefly discussed in my Readable Perl slides). Already mentioned Sub::Curried today.

10,25,50… sequence fun

Debolaz asked in #moose about the best way to create: a list of numbers like 10,25,50,100,250,500,1000,etc without tracking any other state than the number itself Nope, this isn’t A020179 but the much more prosaic A112024. Debolaz wanted this sequence, or something similar to it, for the same reason the US used it for currency – […]

More Perl hate, and what to do about it: AUTOLOAD

A couple of interesting comments to my Five things I hate about Perl. Quicksilver pointed out that I’d missed the difference between arrays and lists. Yup, that’s pretty subtle, and of course it’s bitten me a few times (though oddly enough, I don’t have that strong a dislike of it). Luqui on the other hand […]

Five things I hate about Perl

Enough advocacy, let's get to the nitty gritty of 5 things I hate about Perl. (After brian d foy.) The difference between list and scalar context is subtle. One bug that bites people too often is this (for some value of "people", including me, far too often): sub myfunc { return } my $scalar = […]

Schwartzian transform in Haskell

In the last post, I mentioned that we might be able to improve the performance of our sort using a "". This basically involves precaching the expensive calculation (in this case, length), sorting by the cached value, then taking just the original values. Let's test with a list of words: words "If on a winter's […]

Monads in Perl (take 1)

I've been away for a while from Haskell so I thought I should do some revision and really get my head around Monads. While I plodded through the wonderful "meet the monads" tutorial, I decided that the best way to learn would be to do. By implementing Monads in Perl. I'd highly recommend trying to […]

"Readable Perl" talk slides up

Thanks to Chris and Thom for organising the recent GeekUp Liverpool talks.  The evening started well with Martin Owen's very interesting talk on justifying Erlang, and why FP is going to become a major factor in tomorrow's concurrency-oriented world.  I demonstrated the wisdom of always saving a copy of your talk in PDF to a […]

More Liverpool talks: Perl, Erlang

Thom has posted the details of the next Liverpool geekup, Tuesday May 27th at 3345 Parr Street. Last time, I admitted to programming in Perl and got ribbed about it being unreadable.  Fueled by the fervour of the righteous (and maybe a pint or two of Cains bitter) I volunteered to do a talk on […]

Perl snippet – repeated arrays

On #moose, the channel for a popular modern dialect of Object Oriented Perl, Debolaz asked: <Debolaz> Is there a simple way to produce an array of array like [[1..4],[1..4]] without having to specify the [1..4] multiple times? Matt Trout's reply confused me at first <@mst> map { [ 1..4 ] } (1, 2) because I […]

Common roots

This morning, Ranguard asked an interesting question on 11:27 <@ranguard> What's the best way of finding the common root of two paths, e.g. for /a/b/c/d/e, /a/b/c/1/2/3 I want /a/b/c/ returned, Path::Class::Dir has 'contains', but I'm not sure that's quite right? In my copious free lunchtime, I thought I'd write a version of it in […]