Programming in Poetry

A quiet place at the lagoon side for speaking about all and nothing (the financial crisis, sex, your country, sex, hobbies, or...sex)

Re: Programming in Poetry

Postby qbv8 » Mon, 09Jul06 14:34

Being inspired by Arnulf's idea in http://sharks-lagoon.aceboard.fr/p-2153 ... tm#id92207 I thought about whether it could be possible to write a piece of (syntactically correct) code in an existing programming language that when read, is poetry and when executed, does something meaningful on a computer without producing errors.

As I do not see any fundamental reasons that would inhibit this, the task should be solvable. Therefore I call you all for a contest on "Poetic Programming".

Some research on the net revealed, the world's first Perl poem is a Haiku, written by --- Larry Wall (lwall@jpl-devvax.jpl.nasa.gov) in March of 1990:
[font=Courier New]

print STDOUT q
Just another Perl hacker,
unless $spring
[/font]

Explanation
In this poem, the q operator causes the next character (in this case a newline) to be taken as a single quote, with the next occurrence of that delimiter taken as the closing quote. Thus, the single-quoted line ’Just another Perl hacker,’ is printed to STDOUT. In Perl, the "unless $spring" line is mostly filler, since $spring is undefined. In poetical terms, however, "$spring" is very important: haiku poetry is supposed to specify (directly or indirectly) the season of the year. As for the q operator, that reads in English as the word "queue", which makes perfect sense in the context of the poem.

Some more perl poetry can by found on http://www.digitalcraft.org/iloveyou/im ... Poetry.pdf


And now for the really brain damaged part
And if you, most honourable reader, tend to think that programmers are a bit weird in their minds, have a look at The Shakespeare Programming Language designed to create beautiful source code that resembles Shakespeare Plays.

A simple program that prints out the famous words "Hello, World" looks like this:
The Infamous Hello World Program.

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.


Act I: Hamlet's insults and flattery.

Scene I: The insulting of Romeo.

[Enter Hamlet and Romeo]

Hamlet:
You lying stupid fatherless big smelly half-witted coward!
You are as stupid as the difference between a handsome rich brave
hero and thyself! Speak your mind!

You are as brave as the sum of your fat little stuffed misused dusty
old rotten codpiece and a beautiful fair warm peaceful sunny summer's
day. You are as healthy as the difference between the sum of the
sweetest reddest rose and my father and yourself! Speak your mind!

You are as cowardly as the sum of yourself and the difference
between a big mighty proud kingdom and a horse. Speak your mind.

Speak your mind!

[Exit Romeo]

Scene II: The praising of Juliet.

[Enter Juliet]

Hamlet:
Thou art as sweet as the sum of the sum of Romeo and his horse and his
black cat! Speak thy mind!

[Exit Juliet]

Scene III: The praising of Ophelia.

[Enter Ophelia]

Hamlet:
Thou art as lovely as the product of a large rural town and my amazing
bottomless embroidered purse. Speak thy mind!

Thou art as loving as the product of the bluest clearest sweetest sky
and the sum of a squirrel and a white horse. Thou art as beautiful as
the difference between Juliet and thyself. Speak thy mind!

[Exeunt Ophelia and Hamlet]


Act II: Behind Hamlet's back.

Scene I: Romeo and Juliet's conversation.

[Enter Romeo and Juliet]

Romeo:
Speak your mind. You are as worried as the sum of yourself and the
difference between my small smooth hamster and my nose. Speak your
mind!

Juliet:
Speak YOUR mind! You are as bad as Hamlet! You are as small as the
difference between the square of the difference between my little pony
and your big hairy hound and the cube of your sorry little
codpiece. Speak your mind!

[Exit Romeo]

Scene II: Juliet and Ophelia's conversation.

[Enter Ophelia]

Juliet:
Thou art as good as the quotient between Romeo and the sum of a small
furry animal and a leech. Speak your mind!

Ophelia:
Thou art as disgusting as the quotient between Romeo and twice the
difference between a mistletoe and an oozing infected blister! Speak
your mind!

[Exeunt]

Explanation
[*]There are two different output sentences, "Open your heart" and "Speak your mind". The first causes the character being spoken to output her or his value in numerical form, and the other, being more literal, outputs the corresponding letter, digit, or other character, according to the character set being used by your computer. In this program, only the second form is used. The whole program is a long sequence of constructing a number, writing the corresponding character, constructing the next number, writing the corresponding character, and so on.
[*]The first text until a dot is the title (ignored by the parser).
[*]Dramatis Personae are variables (only Shakespearan names are allowed).
[*]Acts and Scenes are labels.
[*]Enter, Exit (and the plural Exeunt) are needed to make variables viewable. A variable that did not "Enter" can not be used.
[*]Lines are used for output, and as statements which cause a second person to assume a certain value.
[*]Any noun is a constant, the value depends on whether it is nice or not (flower == 1, pig == -1). Prefixing nouns with adjectives multiplies it by 2 (3 adjectives multiply it by 2x2x2=8). Substitution is done by using the word "difference" (This way of writing constants gives you much more poetic freedom than in other programming languages).
[*]Assignment is done by a character name followed by a number (Example: "You lying stupid fatherless big smelly half-witted coward!" reads to you = -64;.

Have fun!

Image
User avatar
qbv8
star of the reef
 
Posts: 483
Joined: Tue, 09Jan27 00:00
Location: Karlsruhe, Germany
sex: Masculine

Re: Programming in Poetry

Postby qbv8 » Mon, 09Jul06 15:56

As a first input to the "Programming in Poetry" contest, today on July 6, 12:42 CET, Squeeky Image has created the first programming on Haiku on this site (see here and here). He calls it

Coded equation

"Clo e and Wend y, (5)
A head ache for our Nan ny. (7)
Sol ving it is Frank." (5)
-------------------------------------
C + W = N?

N? = Frank [img]images/icones/icon10.gif[/img]

Congratulations, Squeeky! [img]kator/smiley207.gif[/img]
User avatar
qbv8
star of the reef
 
Posts: 483
Joined: Tue, 09Jan27 00:00
Location: Karlsruhe, Germany
sex: Masculine

Re: Programming in Poetry

Postby coder » Tue, 09Jul07 01:46

I don't understand. Good elegant code is poetry in itself. I'm thinking of the German word "Gedicht", which is connected to "Verdichtung", just like in Dutch.

Do you mean poetry in any form? Let me explain my question:

Traditional poetry usually had a strict form, like a sonnet or a haiku. The western poetry in particular was meant to be read aloud. Then you have the poems, which are still intended to be read aloud, but whose form is more free.
Than more modern poetry uses the form of the poem on the page as a mean in itself. No longer concerning with the sound, just with associations. One of my favourite Dutch poets even used parts of ads in his poetry in a certain part of his life. ("Singer naaimachine is de beste")

So do you mean poetry in any form? And if so, can a good program not be considered a poem in itself?
User avatar
coder
lagoon predator
 
Posts: 206
Joined: Mon, 09May25 23:00
Location: Netherlands
sex: Masculine

Re: Programming in Poetry

Postby qbv8 » Tue, 09Jul07 02:12

A good program? Yes, of course. But what makes up a good program that may bear the attribute of being poetry?

Just submit one, so that we can see.
User avatar
qbv8
star of the reef
 
Posts: 483
Joined: Tue, 09Jan27 00:00
Location: Karlsruhe, Germany
sex: Masculine

Re: Programming in Poetry

Postby coder » Tue, 09Jul07 02:30

function insertHighScore(position,pname,pscore) {
for (i=9;i>position;i--) {
highScores.names[i]=highScores.names[i-1];
highScores.scores[i]=highScores.scores[i-1];
}
highScores.names[position]=pname;
highScores.scores[position]=pscore;
}
Could this be considered poetry?
User avatar
coder
lagoon predator
 
Posts: 206
Joined: Mon, 09May25 23:00
Location: Netherlands
sex: Masculine

Re: Programming in Poetry

Postby qbv8 » Tue, 09Jul07 03:12

I "good" program combines simplicity and correctness with symmetry and beauty in an outstanding unification. If you have ever had the pleasure of attending a lecture by Edsger W. Dijkstra, than you know what I mean by "beauty" when speaking about computer programs.

Ahem, with all respect, I would not regard that program as being a prominent representative of what could be called Programming in Poetry :) But I am willing to change my mind, if you have good arguments.
User avatar
qbv8
star of the reef
 
Posts: 483
Joined: Tue, 09Jan27 00:00
Location: Karlsruhe, Germany
sex: Masculine

Re: Programming in Poetry

Postby Squeeky » Tue, 09Jul07 06:32

if... a Basic scenario.

Consider this executable QuickBasic* scenario:
..........................
CLS
a = 1

IF a = 1 THEN
PRINT "Wendy Cloe Nanny"
ELSE PRINT "Where is Frank?"

END IF
.....................
The part that interests me however is the IF block. It has the correct Haiku form.

CLS refreshes the screen.
If the second lines reads "a=1" then the output is "Wendy Cloe Nanny". If however a is given some other value the output to screen is "Where is Frank?"




* QuickBasic is a Basic MicroSoft introduced back in the the last DOS versions [5 & 6]
Squeaky is clean, I'm just a tad messy!
User avatar
Squeeky
Spirit of the oceans
 
Posts: 4169
Joined: Mon, 08Jan07 00:00
Location: Australia
sex: Masculine

Re: Programming in Poetry

Postby qbv8 » Tue, 09Jul07 10:13

Thank you, Squeeky, for your second contribution! :)
User avatar
qbv8
star of the reef
 
Posts: 483
Joined: Tue, 09Jan27 00:00
Location: Karlsruhe, Germany
sex: Masculine

Re: Programming in Poetry

Postby coder » Tue, 09Jul07 11:42

I "good" program combines simplicity and correctness with symmetry and beauty in an outstanding unification.

simplicity : check;
correctness : check;
symmetry : syntax error?
beauty : **warning - subjective criterion - ignored**

about the function:
For the given task it's the most simple and efficient way to obtain the goal. It also doesn't need any comments, since it's clear what it does. Symmetry doesn't really apply here, because of the nature of the problem. I don't think Dijkstra would have had any complaints about the code.

I would have expected a German with an interest for philosophy to be able to give more exact criteria. ;)
User avatar
coder
lagoon predator
 
Posts: 206
Joined: Mon, 09May25 23:00
Location: Netherlands
sex: Masculine

Re: Programming in Poetry

Postby qbv8 » Tue, 09Jul07 12:22

My dear coder, when speaking about art, have you ever seen any "objective" or "exact" criteria anywhere in the world that applies to beauty? Oh I forgot: beauty was the first thing that you have eliminated from the list of criteria for good poetry :D

This is like a painting in a museum: people look at it, some say "What a great artist", others say "Big bull..." --- that's life. No really objective criteria. Symmetry was on top of the list of Dijkstra's criteria for a beautiful piece of software. And I had the great luck to attend a lecture given by Dijkstra on the occasion of Niklaus Wirth's 60th birthday. The whole lecture that he gave was one single piece of art; he celebrated it. Great man! very impressive!

So go ahead, beautify the world with your creations. And as every artist in the world: you will be adored, you will be crucified, and anything in between. That's us, the humans :)

Thank you again for your contribution, coder and go ahead, create more!
User avatar
qbv8
star of the reef
 
Posts: 483
Joined: Tue, 09Jan27 00:00
Location: Karlsruhe, Germany
sex: Masculine

Re: Programming in Poetry

Postby coder » Tue, 09Jul07 15:53

Oh I forgot: beauty was the first thing that you have eliminated from the list of criteria for good poetry.

You only mentioned poetry before, not good poetry, I was just testing the boundaries of your idea. That's also a part of programming, isn't it. ;) I'll see if I can write a more poetic piece of code.
User avatar
coder
lagoon predator
 
Posts: 206
Joined: Mon, 09May25 23:00
Location: Netherlands
sex: Masculine

Re: Programming in Poetry

Postby qbv8 » Tue, 09Jul07 16:39

Touché! Testing the boundaries, he?

:lol: I really love this lagoon :lol:
User avatar
qbv8
star of the reef
 
Posts: 483
Joined: Tue, 09Jan27 00:00
Location: Karlsruhe, Germany
sex: Masculine

Re: Programming in Poetry

Postby shark » Wed, 09Jul08 10:55

.
are "Actionscrïpt" codes authorized?

-------------------------

if (dream=true) {
gotoAndPlay ("with cloe");
_root.text="love";
}

-------------------------
User avatar
shark
Site Admin
 
Posts: 4274
Joined: Thu, 06Jul27 23:00
Location: France, Provence
sex: Masculine

Re: Programming in Poetry

Postby LRM » Wed, 09Jul08 11:03

shark wrote : .
are "Actionscrïpt" codes authorized?

-------------------------

if (dream=true) {
gotoAndPlay ("with cloe");
_root.text="love";
}

-------------------------

I won't comment on whether it's good poetry or not but it tickled my funny bone...LOL
L
Got Wood?
User avatar
LRM
Moderator
 
Posts: 3061
Joined: Wed, 09Apr22 23:00
Location: Citizen of the world, residing in the USA
sex: Masculine

Re: Programming in Poetry

Postby qbv8 » Wed, 09Jul08 11:52

Hi Shark
Thank you for your contribution. Of course, Actionscrïpt is allowed. Any language is authorized as long as it is interpretable by some (existing) computer software and does something meaningful (i.e. not just produces syntax errors).

I am currently working on something in C, but this can still take a long time if I look at my experiments of the last 48 hours ... :lol:
User avatar
qbv8
star of the reef
 
Posts: 483
Joined: Tue, 09Jan27 00:00
Location: Karlsruhe, Germany
sex: Masculine

Next

Return to The beach

Who is online

Users browsing this forum: No registered users and 9 guests

eXTReMe Tracker