Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

The Lighter Side of Perl Culture (Part V): Poetry

by eyepopslikeamosquito (Archbishop)
on Apr 25, 2005 at 14:10 UTC ( [id://451207]=perlmeditation: print w/replies, xml ) Need Help??

28th March 1990: You are sitting at your workstation inside the most advanced aerospace agency on Earth. Concentrating, intensely concentrating, busy designing the most advanced postmodern programming language on Earth. But wait, what's that noise? A poetry reading? In the next cubicle? You must be joking! No ... clear as a bell, you hear:

I'd travel to the ends of time
For you, my one, my only love.
I'd force the sun to leave its track
(If you were lost) to fetch you back.
I'd suck the juices from a lime,
I'd re-write Moby Dick in rhyme,
I'd happily commit a crime,
For you my dearest darling dove.
I'd do it all, and more beside;
Now *would* you take the trash outside?

Startled, and startling your co-workers, you shout your defiant response through cupped hands over the cubicle wall:

I've taken the trash out innumerable times,
I've taken the trash out in inclement climes,
I've taken the trash out 'cuz that's what I do,
But I won't take the trash out when you tell me to.

Though I doubt it happened exactly like that, just three days after this historic rec.arts.poems sharon-larry-esque exchange, in what formed the most celebrated April Fools joke in Perl history, a bizarre request to create a new comp.lang.perl.poems newsgroup appeared, supposedly sent by Larry Wall and doubtless egged on from the next cubicle.

There is little doubt that the whole Perl poetry movement sparked from this single chance event. Had Larry and gifted poet Sharon Hopkins not been working together at JPL would Perl poetry exist today?

I know it's weird, but it does make it easier to write poetry in perl. :-)

-- Larry Wall "explains" why sort X is syntactically valid on comp.lang.perl 21 April 1990

But also barewords were added so that Sharon could write better poetry. Hence, it is also called "poetry mode" in some of my earlier writings.

-- oldbie merlyn answers a packrats mailing list question

The quotes above reaffirm Perl as the premier computer language for writing poetry -- and indeed perhaps the only computer language in history where the ability to compose poems actually affected its design.

This, the fifth episode of the long running series on the lighter side of Perl culture, focuses on Perl Poetry 🦪📜🪶

Why is Perl a Good Language for Writing Poetry?

Look at the use of parentheses in Lisp or the use of white space as syntax in Python. Or the mandatory use of objects in many languages, including Java. All of these are ways of taking freedom away from the end user 'for their own good'. They're just versions of Orwell's Newspeak, in which it's impossible to think bad thoughts.

-- Larry Wall in Larry Wall, the Guru of Perl (linuxjournal article)

Some language designers hope to enforce style through various typographical means such as forcing (more or less) one statement per line. This is all very well for poetry, but I don't think I want to force everyone to write poetry in Perl.

-- Larry Wall in Natural Language Principles in Perl

No, really, I don't want an identification division. The problem with identification division is it really puts a crimp in Perl's poetry, or in Cobalt poetry. How many poems can you start off identification division? One.

-- Larry Wall in State of the Onion 2000

The Perl programming language has proved to be well suited to the creation of poetry that not only has meaning in itself, but can also be successfully executed by a computer.

-- Sharon Hopkins in Camels and Needles

The key point from the quotes above is that, in the spirit of freedom and TMTOWTDI, Perl allows you to write poetry without forcing you to do so.

Perhaps the primary reason why Perl is so well suited to writing poetry is simply that it was designed, not by a computer scientist like most computer languages, but by a linguist. Curiously, Larry attended linguistics graduate school at U.C.Berkeley at around the same time as Bill Joy and his BSD cohorts attended computer science graduate school there. As far as I'm aware, they did not write any poems together while at Berkeley.

Perl's poetry support was further strengthened by the chance circumstance of an enthusiastic and innovative poet, namely the reigning Perl poetry pump-queen Sharon Hopkins, sitting right next to Larry at JPL during Perl's formative years. Newsgroup messages suggest that Larry moved from JPL to netlabs in July 1991, and that Sharon followed him there about one year later.

What Makes a Good Perl Poem?

There is little difference between a good conventional poem and a good Perl one; it's just that the Perl poem must satisfy an additional constraint of compiling (and optionally running) without error.

As you might expect, it is much harder to write a Perl poem that actually runs without error. So much so that most Perl poets satisfy themselves with poems that merely pass perl -c.

For more details on this subject, including examples that poetically produce text output when run, thus extending the theme developed within the poem's source code, see Sharon Hopkins' definitive work: Camels and Needles.

History

In 1962, the French Oulipo movement proposed the idea of poetry written in programming languages. As described here, however, it took ten years before anyone actually did it, the first poems being penned by Le Lionnais and Noel Arnaud in the Algol programming language in the early 1970s.

Though history.perl.org credits Larry Wall with writing the first Perl poem in March 1990:

print STDOUT q Just another Perl Hacker, unless $spring
Sharon Hopkins and merlyn should perhaps share the glory (or blame, depending on your point of view :-) -- merlyn for inventing the JAPH, Sharon for suggesting that Larry write a JAPH in the form of a haiku. Notice that, when read aloud with canonical Perl poetic pronunciation, namely:
print standard out queue Just another Perl Hacker, unless dollar spring
this poem does indeed qualify as a haiku (5-7-5 syllables). Notice too that this Perl 3 code no longer runs with modern perls.

Sharon Hopkins hosted the first First Perl Poetry Contest in August 1991. This contest was won by Dr. Craig Allen Counterman, Ph.D, with a rollicking rhyme, "Time to Party". Alas, the contest could hardly be called a success because this was the only entry received and, by the author's own admission, was less inspired than his more scholarly earlier work "Ode to my Thesis". Both of Craig's poems can be found in Camels and Needles.

Numerous Perl poetry contests have been run since then by Kevin Meltzer of The Perl Journal, by TPC, and by ActiveState. There was even one run here at Perl Monks: Aaah, spring (A Very Special Perlmonks Contest). See the References section below for links.

Around 1999, there was an explosion of interest in haiku, sparked by TheDamian's delightful Coy module.

Haiku and Coy

A haiku is a
short poem that's 17
syllables in length.
...
The 5-7-5
art form is widely practiced
on the Internet.
...
Damian Conway
is stuck inside a haiku
and he can't get out!

-- From Damian Conway's 1999 TPJ Coy article (180 verses omitted!)

Damian Conway's prize-winning Coy module caused a sensation when it debuted in 1999. Essentially a drop-in replacement for Carp, the module itself is quite sophisticated, featuring an extensible data-driven poem generator. The entire Coy module documentation is written in haiku; here is the module description:

Error messages strewn across my terminal. A vein starts to throb. Their reproof adds the injury of insult to the shame of failure. When a program dies what you need is a moment of serenity. The Coy.pm module brings tranquillity to your debugging. The module alters the behaviour of die and warn (and croak and carp). It also provides transcend and enlighten -- two Zen alternatives. Like Carp.pm, Coy reports errors from the caller's point-of-view. But it prefaces the bad news of failure with a soothing haiku.

As if that were not enough, TheDamian went on to write a complete TPJ article in 183 haiku verses!

At TPC 4 in 2000, the Haiku Contest was won by chipmunk with his summer.pl (that is both a sum-er and a season):

sub summer { my $sum; $sum += $_ for @_; $sum } print summer (split);

Some Classic Poems

These come with the usual caveat that there are many Perl poems I've never seen, so if you know of a good one, please let us know!

References

References Added Later

Other Articles in This Series

See Also

Replies are listed 'Best First'.
Re: The Lighter Side of Perl Culture (Part V)
by Roy Johnson (Monsignor) on Apr 25, 2005 at 15:59 UTC
    I really thought you were going to say that the "take the trash out" exchange is how automatic garbage collection made its way into Perl.

    Caution: Contents may have been coded under pressure.
Re: The Lighter Side of Perl Culture (Part V)
by japhy (Canon) on Apr 25, 2005 at 17:27 UTC
    Is $_ pronounced "it" and @_ pronounced "them" in Perl haiku?

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
Re: The Lighter Side of Perl Culture (Part V)
by Tanktalus (Canon) on Apr 25, 2005 at 21:24 UTC

    Did anyone else look at this quote from Larry:

    Look at the use of parentheses in Lisp or the use of white space as syntax in Python. Or the mandatory use of objects in many languages, including Java. All of these are ways of taking freedom away from the end user 'for their own good'. They're just versions of Orwell's Newspeak, in which it's impossible to think bad thoughts.
    and think, "Isn't whitespace part of syntax in perl 6?"

      Not in the same way as Python. It's natural enough for whitespace to be required between certain tokens, or even all tokens. The requirements of presence or absence of whitespace isn't what Larry was addressing.

      A space or tab in Python isn't just separating active tokens, it is an active token. Python actually uses the amount of whitespace between visible tokens to change the order of execution.



      Christopher E. Stith
      Worse! Perl6 also has parentheses!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://451207]
Approved by herveus
Front-paged by Fletch
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-11-10 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    chatterbot is...






    Results (38 votes). Check out past polls.