Perl helps prove universality of 2, 3 Turing machine

Posted by Tom Moertel Fri, 26 Oct 2007 17:23:00 GMT

Alex Smith, a 20-year-old EE student in the UK, proved that the 2, 3 Turing machine is universal. In doing so, he was able to claim the $25,000 prize that Stephen Wolfram offered for the first proof (or disproof) of the 2, 3 machine’s universality.

This story has been getting a lot of attention lately, but one part of the story has not: that the Perl programming language is featured in the proof. In his documentation of the proof, Universality of Wolfram’s 2, 3 Turing Machine, Smith wrote, “I have written several Perl programs, to demonstrate the constructions given in the proof and to interpret the systems given in various conjectures.” Smith’s proof includes no fewer than 7 Perl programs.

Go Perl!

Posted in
Tags , ,
1 comment
no trackbacks
Reddit Delicious

PPW 2007: a twenty-ton can of programming whoop-ass

Posted by Tom Moertel Tue, 25 Sep 2007 23:04:00 GMT

I am on the planning committee for the Pittsburgh Perl Workshop. So far, it’s been an interesting ride. Last year was the first PPW, and it went surprisingly well. In the post-conference surveys, 94 percent of respondents said they wanted to come back for another PPW, so we committed ourselves to repeating the grueling conference-planning process for 2007. (Fact: making big commitments like this is much more likely to happen if you’re drinking beer at the time.)

Now a year has gone by, and PPW 2007 is only three weeks away. This year’s conference is 100% larger – two full days – and offers a new, much-asked-for option: a one-day introductory course to give programmers new to Perl a quick dose of the language so they can dive into the rest of the conference. This year’s conference also offers a full-length Hackathon for those who feel the urge to code at the conference.

The main attraction, however, is the conference’s wide array of technical talks. We have retained the same mix of industry and academic speakers that attendees said they liked so much last year. Indeed, our speaker list includes some of last year’s most fascinating speakers, as well as many new speakers drawn from the world of Perl. No matter what your interests are, you’ll find talks for you at PPW 2007. (I’m particularly interested in the talks on continuation-based web applications, the cool new stuff in Perl 5.10, and the Moose object system.)

All of this is to say: Do not miss PPW 2007! Where else are you going to find so many interesting people, so many fascinating talks, and so many opportunities to have fun and make friends while learning useful stuff, all for so little expense? (Regular admission is only $70, and students get a big discount.) Get your ticket now because over half of the seats are already gone.

I hope to see you there.

Posted in
Tags , , , ,
no comments
no trackbacks
Reddit Delicious

Pittsburgh Perl Workshop 2007: Don't miss your chance to speak!

Posted by Tom Moertel Mon, 20 Aug 2007 23:18:00 GMT

This year’s Pittsburgh Perl Workshop is shaping up to be uber-techno-awesome. This year, it’s two big days of lively technical talks and full-force Perl festiveness. Yes, come October, programmers of all stripes will gather in Pittsburgh over the weekend of the 13th to grab a slice of the fun. A big slice. And you – yes you, my friend – should be there.

Lots of interesting talks are flowing in, but it’s not too late to grab a speaking slot. If you have anything interesting to say about Perl, now is your time. 20- and 50-minute slots are available. To claim one, just go to pghpw.org and submit a talk proposal. It’s easy. But act now, before it’s too late!

If you have any interest in Perl, you’ll want to be at PPW 2007, and if you have anything to say about Perl, you’ll definitely want to speak at PPW 2007.

Don’t miss your opportunity. Seize the day!

Posted in
Tags , , ,
no comments
no trackbacks
Reddit Delicious

Talk: Fun with Numbers: R and Perl (and IMDB data)

Posted by Tom Moertel Thu, 21 Jun 2007 18:38:00 GMT

Last week I gave a talk on the R statistics system and Perl for the Pittsburgh Perl Mongers. The example that threaded through the talk was something I have written about here before, extracting useful information from the Internet Movie Database. If you’ve read my earlier blog post or have used the Grand Unified IMDB Movie Rating Decoder Ring, you might find the slides from the talk interesting. They provide some more details about the R and Perl code used to analyze the IMDB data and create the decoder ring.

You can get the slides here:

Title slide from my talk on R and Perl

Posted in
Tags , , , ,
2 comments
no trackbacks
Reddit Delicious

The 2006 Pittsburgh Perl Workshop is a ten-ton can of programming whoop-ass

Posted by Tom Moertel Tue, 12 Sep 2006 21:30:00 GMT

I am on the planning committee for the 2006 Pittsburgh Perl Workshop and serve as the primary point of contact for speakers. That means I get the inside scoop on the talks. And from what I have seen, all I can say is, These talks kick ass. Well, actually I can say one more thing:

If there is any possible way you can manage to get yourself to Pittsburgh, Pennsylvania on Saturday, 23 September 2006, do not wait, do not mull it over, register now for the Pittsburgh Perl Workshop.

If you miss this one, you’ll probably end up weeping in front of your keyboard for a long, long time.

Perl At Work

PPW ’06 has speakers from the worlds of finance, bioinformatics, engineering, politics, health care, insurance, Web-2.0 start-ups, environmental monitoring, and mathematics. And they all have fascinating things to share with you about how they make Perl work for them and about how you can make Perl work for you.

Registration is only $20 – can you imagine that, in an age when programming conferences routinely cost hundreds if not thousands of dollars? – and all of the talks show you how to use Perl to do real work, solve real problems, and make your real life as a programming professional a whole lot saner. Even if you think you don’t care about Perl, you ought to be a part of PPW ’06 just for the rare opportunity to discover something you may have overlooked. (At $20, when are you ever going to get a chance like this again?)

Posted in ,
Tags , , , , , ,
1 comment
no trackbacks
Reddit Delicious

Solving the Google Code Jam "countPaths" problem in Perl

Posted by Tom Moertel Thu, 17 Aug 2006 06:21:00 GMT

As promised, here’s a Perl version of a dynamic-programming-based solver for the Google Code Jam “countPaths” problem. It is a straight translation of my improved Ruby implementation. As you might expect, the Perl version was pretty fast. It proved faster than the other scripting-language implementations I tried (in this rather unscientific benchmark, not to be taken seriously):

ImplementationRun time (s)
Haskell 0.9
Perl (code below) 1.7
Python 2.8
Ruby 4.2

All timings were taken while solving the maximum-size, all-the-same-letter problem on my 1.8-GHz Opteron box.

Here’s the Perl implementation:

#!/usr/bin/perl

# Tom Moertel <tom@moertel.com>
# 2006-08-16
#
# Perl-based solution to the Google Code Jam problem "countPaths".
# See http://www.cs.uic.edu/~hnagaraj/articles/code-jam/ for more.

use strict;
use warnings;

use List::Util 'sum';
use Math::BigInt;

sub count_paths {

  my ($grid, $word) = @_;

  my $rword  = reverse $word;
  my $rowmax = $#$grid;
  my $colmax = length($grid->[0]);
  my ($slab, $sum);

  for my $i (0 .. length($rword) - 1) {
    my $char = substr $rword, $i, 1;
    ($slab, my $previous_slab) = ([], $slab);
    for my $r (0 .. $rowmax) {
      my ($row, $line) = ($grid->[$r], $slab->[$r] ||= []);
      for my $c (0 .. $colmax) {
        $line->[$c] = $char ne substr($row,$c,1) ? 0 : $i == 0 ? 1 : do {
          $sum = 0;
          my $clo = $c > 0 ? $c - 1 : $c;
          my $chi = $c < $colmax ? $c + 1 : $c;
          for my $nr (($r>0 ? $r-1 : $r) .. ($r<$rowmax ? $r+1 : $r)) {
            for my $nc ($clo .. $chi) {
              $sum += $previous_slab->[$nr][$nc]
                if $nr != $r || $nc != $c;
            }
          }
          $sum;
        }
      }
    }
  }

  sum map @$_, @$slab;
}

print count_paths([("A"x50)x50], "A"x50), $/;
# 3.03835410591851e+47
Update: I simplified the code a whisper by removing an unnecessary variable $counts. Here’s a diff if you’re curious about what’s changed:
--- countpaths.pl.orig  2006-08-18 00:16:56.000000000 -0400
+++ /countpaths.pl      2006-08-18 00:19:30.000000000 -0400
@@ -19,11 +19,11 @@
   my $rword  = reverse $word;
   my $rowmax = $#$grid;
   my $colmax = length($grid->[0]);
-  my ($counts, $slab, $sum);
+  my ($slab, $sum);

   for my $i (0 .. length($rword) - 1) {
     my $char = substr $rword, $i, 1;
-    ($slab, my $previous_slab) = ($counts->[$i] ||= [], $slab);
+    ($slab, my $previous_slab) = ([], $slab);
     for my $r (0 .. $rowmax) {
       my ($row, $line) = ($grid->[$r], $slab->[$r] ||= []);
       for my $c (0 .. $colmax) {

Update 2: Augmented the introductory paragraph with a parenthetical comment that reminds readers that these single-fuzzy-data-point-style timings should not be taken seriously. Also removed the word “bested,” which might suggest that there is an optimization contest in play. Please, no wagering.

Update 3: Stripped another variable ($j), which was completely unused and leftover from previous implementation. (See why you shouldn’t code late at night?)

Posted in , ,
Tags , , , , , ,
2 comments
no trackbacks
Reddit Delicious

LectroTest: new release, new talk, and the new LectroTest Emporium!

Posted by Tom Moertel Tue, 27 Jun 2006 18:21:00 GMT

LectroTest Robot

I have a bunch of LectroTest news. LectroTest, as you may know, is a specification-based, automatic testing system for Perl. It may look like Haskell’s QuickCheck, but it tastes like sweet, sweet Perl.

LectroTest 0.3500 was released

This version adds automatic tools for recording and playing back failures. Using them, you can automatically build regression-testing suites and incorporate them into your testing plan. All it takes is one new line of code:

use Test::LectroTest
    regressions => "regressions.txt";   # <-- that's it!

See the docs on CPAN for more.

My thanks to Steffen Müller, who suggested the feature and is already using it in cool stuff such as Number::WithError.

Slides from “Testing Tips with LectroTest” are now online

You can get the slides from my talk to the Pittsburgh Perl Mongers on 2006-06-14 here: Talk / Testing Tips with LectroTest. In the talk, I covered some of the newer LectroTest features, such as regression testing and Test::LectroTest::Compat, which lets you mix LectroTest with other Perl testing modules.

The LectroTest Emporium opens!

I have very little artistic ability. Nevertheless, alarming numbers of people seem to love the fiercely metallic mascot I created for LectroTest.

At the last Perl Mongers meeting, for example, people actually told me (somewhat sternly) I should put the adorable LectroTest Robot on t-shirts. I am now delighted to announce that I have taken their advice:

Introducing: The LectroTest Emporium

Some important points:

  • Yes, it’s a CafePress store
  • I’m not making any money on these things
  • I’m using direct printing, not heat-transfer printing, so the Robot won’t crack, feel stiff, or suffer from a yellowish transfer background. (CafePress has a comparison of the methods if you want the full details.)

Some items I have moral reservations about offering:

  • LectroTest Robot Teddy Bear - Who would be so reckless as to allow something as fierce and as powerful as the LectroTest Robot to come into direct contact with a defenseless, cuddly teddy bear?
  • LectroTest Robot Baby Bib - Actually, this is a great idea: your infant and the Robot exist in a symbiotic relationship. When your baby gets food all over the bib, the Robot will consume it (using a electrochemical process not entirely dissimilar to our human concept of “digestion”). Thus is the baby cleaned and the Robot fueled. It’s win-win.
  • LectroTest Robot Dog T-Shirt - I am fairly certain that the immense weight of the Robot would easily crush any smaller animal. This product strikes me as a very bad idea.

The T-shirts, on the other hand, are the robot’s meow. Check out the full collection at The LectroTest Emporium.

Posted in , , , ,
Tags , ,
1 comment
no trackbacks
Reddit Delicious

Talk: Embedded domain-specific languages for Perl

Posted by Tom Moertel Tue, 14 Mar 2006 22:39:00 GMT

Last week I gave a brief talk for the Pittsburgh Perl Mongers about embedding domain-specific languages into Perl. The slides from the talk are now available: Embedding an XHTML template language into Perl.

Title slide from my talk on embedding domain-specific languages into Perl

Posted in , ,
Tags , , ,
no comments
no trackbacks
Reddit Delicious

Finding duplicate words in writing: a handy Perl script

Posted by Tom Moertel Wed, 01 Mar 2006 20:17:00 GMT

The human mind subconsciously corrects mistakes while we read. This mental feature has a nasty drawback for writers: when proofreading, we often miss our own mistakes.

One of the most common writing mistakes that our brains stealthily correct is the the duplicate word problem. For example, the duplicate the words in the previous sentence. Did you catch them?

If so, don’t be too proud of your accomplishment. It is easier to see errors in others’ writing than in your own. Your brain is attuned to your natural writing patterns and much more likely to repair your mistakes without your knowing.

To overcome this problem, some writers recommend reading your work backward, but I think computers are a more practical solution.

Here’s the Perl script that I use to spot duplicate words:

#!/usr/bin/perl -n00
# dupwords.pl - find duplicate words in the input stream

print "$ARGV: para $.: ($1)\n" 
    while /(\b(\w+)\b\s+\b\2\b)/sg;

I use this script from Emacs via shell-command-on-region. I also use it from the command line to find duplicate-word errors in batch:

find . -name '*.txt' | xargs dupwords.pl

The duplicate-words problem is a favorite for programming cookbooks, so if you don’t like my recipe (or Perl), you have many other options.

Posted in ,
Tags , ,
no comments
no trackbacks
Reddit Delicious

Damian Conway's talk on Sufficiently Advanced Technologies

Posted by Tom Moertel Tue, 01 Nov 2005 19:41:00 GMT

Over the weekend I attended Damian Conway’s talk on Sufficiently Advanced Technologies, hosted by the Pittsburgh Perl Mongers and presented at CMU.

Read more...

Posted in ,
Tags , , ,
no comments
no trackbacks
Reddit Delicious

Older posts: 1 2