develooper Front page | perl.perl5.porters | Postings from February 2011

Re: Optimizing qr/STRING/msixpodual for amusement

Thread Previous | Thread Next
From:
Philippe Bruhat
Date:
February 21, 2011 05:05
Subject:
Re: Optimizing qr/STRING/msixpodual for amusement
Message ID:
20110221130521.GF2769@swoosh
On Mon, Feb 21, 2011 at 12:47:54AM +0100, Ævar Arnfjörð Bjarmason wrote:
> (You do not have to read this)
> 
> So Father Chrysostomos just modified perlop like this:
> 
>     -=item qr/STRING/msixpo
>     +=item qr/STRING/msixpodual
> 
> Which got me thinking. That's a lot of letters, I wonder what words we
> can make out of them (no I'm not suggesting we use them).
> 
> So I came up with this quick hack: https://gist.github.com/836425
> 
> Which when I pipe in the wamerican-huge dictionary from Debian gives
> us these canditates:
> 
>     $ perl msixpodual-words.pl </usr/share/dict/words | head -n 30
>     Score Word     Remaining
>     8     plasmoid xu
>     8     paludism xo
>     8     alodiums xp
>     8     diplomas xu
>     7     podiums  xal
>     7     lipomas  xdu
>     7     spodium  xal
>     7     uploads  mix
>     7     adipous  mxl
>     7     amidols  xpu
>     7     solidum  xpa
>     7     alodium  sxp
>     7     diploma  sxu
>     7     plasmid  xou
>     7     dualism  xpo
>     6     sodium   xpal
>     6     axoids   mpul
>     6     audios   mxpl
>     6     Alidus   mxpo
>     6     ampuls   ixod
>     6     Louisa   mxpd
>     6     miaous   xpdl
>     6     modius   xpal
>     6     Dupaix   msol
>     6     almous   ixpd
>     6     dismal   xpou
>     6     Musial   xpod
>     6     poilus   mxda
>     6     uplaid   msxo
> 
> Maybe I can submit a patch in the beginning of the month immediately
> following March that changes all our regex flag documentation to refer
> to:
> 
>     qr/STRING/xuplasmoid

In my time, we didn't have all those extra options... ;-)

As part of the $A++ competition of Paris.pm,  I wrote those in 2000:

    $A=~s/(-)?(\d+(?:\.\d*)?)/"$1 1+"x$2.'1'/egoisme

    $A=~s/(-)?(\d+(?:\.\d*)?)/#les filles c'est des cloches (Souchon)
                          "$1 1+"x$2.'1'/sexisme

As part of a fun article I started but never finished, I also wanted to
obsolete the /x option by using the option list to make comments about the
regexp, instead of puttin comments inside the regexp (in French, sorry):

    s/rature|erreur//gomme           # rature|error = mistake, gomme = eraser

    s/propriété individuelle//coco   # see below

    s/individual property//commie    # translation of the above

    s/(.+)\1/$1/sosie                # double (as in "stunt double")

    s/./"$&:"/immisce                # s'immiscer = to muscle in

Now P5P has spoilt the fun by making the game too easy. ;-)

-- 
 Philippe Bruhat (BooK)

 For every winner, there must be one or more losers.
                                (Moral to the Sage story in Groo #111 (Epic))

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About