Who says computers can’t write poetry?

When I finished the last of guacamole a week or two ago, I thought I was being exceptionally clever when I left my roommate a poem apologizing for finishing it off, in case they had wanted some. My poem was a parody of William Carlos Williams’ “This Is Just To Say.” The original poem goes:

I have eaten
the plums
that were in
the icebox

and which
you were probably
saving
for breakfast

Forgive me
they were delicious
so sweet
and so cold

I was under the impression that this poem was famous, since we had read it in 6th grade English and then again in 11th grade Poetry class. Anyway, I revised it to be about guacamole instead of plums. I was so proud of the product that I texted my version of the poem to a friend from high school, who then responded with some good-natured “haha”s and said that she had done the exact same thing to her roommate last year.

Then it struck me: the need to recycle William Carlos Williams’ poem to apologize for eating food must be a very common one!

I decided to write a William Carlos Williams poem generator to apologize for eating food that someone else may have wanted. After the user filled out information about the food and its particular deliciousness in an HTML form, I would build a JavaScript program to generate a mad libs style William Carlos Williams poem.

But something was missing–obviously, you would want your roommate to read the poem! But what were you supposed to do, print it out? Nobody has a printer. They’re too bulky and you can read everything on a computer anyway. You needed to be able to text or at least email the poem to your roommate.

So I turned to PHP, which I knew had a mail function. If you Google “mail form php tutorial,” it’s very easy to set up. I used jQuery to print the poem not only on the page, but also in a textarea of a new form designed to send mail with PHP. All the user had to do was enter their friend’s email and hit “Submit” for the poetic apology to be delivered to their friend.

The finished product is This Is Just To Say: