Are there any links between poetry and computing? Seems unlikely. But …
Here’s one of my favourite poems for you to contemplate, about recursion.
Great fleas Have Lesser Fleas,
upon Their backs To Bite’em,
And Lesser Fleas Have Lesser fleas,
And So, Ad infinitum.
and Those great Fleas, Themselves, In turn
Have Greater Fleas To go On;
while Those Again have Greater still,
And greater Still, And So on.
This poem is by Victorian logician Augustus De Morgan famous for his laws of boolean logic also Maths tutor of Victorian computer scientist Ada Lovelace. He also made the idea of mathematical induction rigorous. It is the basis of how you prove recursive programs (and iterative ones) are correct.
An Ode to technology
The island of Rhodes in Ancient Greece was a centre for mechanical engineering at the time, and the Greeks were great inventors. According to an Ode by Pindar the island was covered with automata:
The animated figures stand
Adorning every public street
And seem to breathe in stone, or
move their marble feet
Counting rhymes make a really good introduction to counter-controlled loops ie “for loops” too, so why not write programs that automatically generate rhymes like 10 green bottles, or for your favourite counting book.
You can then make variations like: “100 green bottles sitting on a wall…and if 5 green bottles should accidentally fall…”
Infinite Families of Poems
Take the above idea further, adding parameters to your poems, and suddenly poems as programs makes it possible to write infinite families of poems rather than just old-fashioned single poems.
Non-termination is an important concept in programming, though one you often try to avoid. Never-ending poems (eg The Song That Never Ends) are the poetic equivalent (See also our compressed one below). Can you write a non-terminating poem of your own?
As poems are often repetitive you can play at compressing and uncompressing them and learn about compression algorithms while contemplating poetry as here.
18 4 18 4 18 4 …
Uncompress it using the code book:
1 [a] 2 [and] 3 [are] 4 [because] 5 [do] 6 [fun] 7 [have] 8 [lot] 9 [of] 10 [rabbits] 11 [them] 12 [there] 13 [why] 14 [1 8 9] 15 [10 7] 16 [14 11] 17 [15 14 6] 18 [17 13 5 17 4 12 3 16 2 13 3 12 16 ]
Magical Poem Magic
You can turn your favourite poem into a magic trick (as long as it is long enough) that illustrates what an algorithm is, exhaustive testing and the idea of rigorous logical reasoning to do proof. See how here
Pseudocode poems are poems that also work as programs eg
My love for you is endless my love is true while my love is true I love you
Here it is implemented as a Python program.
def myloveforyouisendless(): """My love for you is endless""" my_love = True while my_love == True: print('I love you') myloveforyouisendless()
What does it do when executed? There are more on our Pseudocode poems page. Can you write your own?
Programming shapely poems
Inspired by the poems of the wonderful poet @brian_bilston you could write a program (a python poem) that shapes poetry such as twitter.com/brian_bilston/
Give your program a poem and it should format it in a shape following a number sequence.
See how here
Write a poem writing program
Of course any self-respecting computer scientist, nervous of writing their own poems would just write a program to write them for her/him. Start with Strachey’s 1950s love letter program ideas teachinglondoncomputing.org/writing-love-c You need to include rhyming word lists for the program to choose from if your poems are to rhyme.
Rockstar David Bowie cowrote one of the first creative computing programs and used it to help write lyrics, automating the “cut-up” technique he used. It involves taking random sentences (eg from a newspaper) splitting them in half and then recombining them with different halves. His program helped generate lines for some of his most famous songs (its partly why they are often so surreal).
Over several years cs4fn challenged our readers to write limericks on computing topics. We gave the first lines. They came up with the limericks. Here are some we liked best. cs4fn.org/limericks/ Other limericks are scattered around the cs4fn web pages. You have to find them.
Ada Lovelace and Lord Byron
A last poem-computing link: Victorian Countess, Ada Lovelace worked on the first computer. Her father was the poet Lord Byron.
Programs change the world by changing the way we do things, though not always for the best. Poems and especially protest songs change the world too, by making people think.
Can you name some programs/algorithms and poems/songs that you think helped change the world?
The algorithms and so programs behind the web and public key encryption are examples of the former. Hearing Free Nelson Mandela, by The Special A.K.A certainly led to me finding out more about apartheid. The songs of Bruce Springsteen supposedly helped bring down the Berlin Wall as a result of his concert in East Berlin. Joni Mitchell with its line about paving paradise helped make me environmentally aware.