[kw-pm] Free beer: still unclaimed!

Eric - fishbot eric at uc.org
Wed Nov 17 23:25:03 CST 2004


> I daebetd and daebted wehethr I tuhhogt tihs was a cool
> egonuh use of map...  and I tnihk I'll let you dcdiee. :)
>
> perl -pe 's/\B(\w+)\B/join"",map chop,sort map{rand().$_}split"",$1/eg'

What amazes me most about this is not so much the code but the
fact that it is pretty fast.  I ran this over my entire kw-pm
mailbox (16,000 lines of text) and it took 4 seconds. Considering
a random number is generated for every internal letter... that's
amazing to me.  It did my 230,000 word dictionary in 24 seconds.

I hope that I haven't given away too much.  Daniel gets to
explain this tomorrow.

I put the example on the wiki here:
http://kw.pm.org/wiki/index.cgi?GrepMapExamples

So that we can discuss it onscreen.  Add yours soon!  A second
beer hangs in the balance.  I think that Daniel has got a lock on
the first.

fishbot


More information about the kw-pm mailing list