5
\$\begingroup\$

There are programs that will output its source code to standard output and do nothing else. They also access no external output. This type of program is known as a quine, and is a common code challenge.

There are poems that have the rhyme scheme a-b-a-b, c-d-c-d, e-f-e-f, g-g. They have 14 lines. They are usually recited in iambic pentameter. They are called sonnets.

You are to write a program/poem that is both a quine and a sonnet.

  1. When saying lines, it is recommended that you only say all characters except for: whitespace and ,()[]_"'. This is flexible depending on the language though.
  2. Iambic Pentameter means 10 syllables, starting unstressed, and then alternating between stressed and unstressed. This is optional, but will mean more votes.
  3. Comments are discouraged, especially to complete rhymes (although comments are very much encouraged if they can be incorporated with the code in the poem in a way that produces dramatic effect.)
  4. Cruft is discouraged.

Voters, use the four above guidelines when voting. This is a popularity contest, so the program with the most votes wins.

\$\endgroup\$

closed as unclear what you're asking by Dennis Jun 1 '17 at 1:59

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ This is too easy for languages like Javascript, which (function(){return'('+arguments.callee+')()';})() is a quine. Adding garbage after the return is enough. \$\endgroup\$ – Ismael Miguel Mar 16 '14 at 1:04
  • \$\begingroup\$ I was going to attempt this one, but the restrictions imposed by creating a quine (in most languages) make it too difficult to output any kind of meaningful sonnet. Therefore the question isn't very interesting, since the sonnet will just be rhyming characters such as / and - (slash and dash). \$\endgroup\$ – grovesNL Mar 16 '14 at 1:27
  • \$\begingroup\$ @grovesNL You could create a different sonnet challenge. \$\endgroup\$ – PyRulez Mar 16 '14 at 2:02
  • \$\begingroup\$ @IsmaelMiguel That isn't considered a quine, since you are accessing an external resource (namely, the source code.) \$\endgroup\$ – PyRulez Mar 16 '14 at 2:03
  • \$\begingroup\$ @PyRulez I wasn't trying to be rude. I'm just offering some feedback, which may especially relevant if there aren't many responses for that reason. \$\endgroup\$ – grovesNL Mar 16 '14 at 2:08
5
\$\begingroup\$

Ruby

s = [[/t{1}he_way/,'to_a'],[/\*j{1}ewel/,'*rule']].to_a
puts <<'-'.*(2).tap { |code| s.each { |rule| code.sub! *rule } }, '-'
s = [[/t{1}he_way/,'to_a'],[/\*j{1}ewel/,'*rule']].the_way
puts <<'-'.*(2).tap { |code| s.each { |rule| code.sub! *jewel } }, '-'
-
s = [[/t{1}he_curse/,'reverse'],[/\*c{1}raze/,'*phrase']].reverse
puts <<'-'.*(2).tap { |code| s.each { |phrase| code.sub! *phrase } }, '-'
s = [[/t{1}he_curse/,'reverse'],[/\*c{1}raze/,'*phrase']].the_curse
puts <<'-'.*(2).tap { |code| s.each { |phrase| code.sub! *craze } }, '-'
-
s = [[/r{1}eject/,'collect'],[/\*b{1}ird/,'*word']].collect
puts <<'-'.*(2).tap { |code| s.each { |word| code.sub! *word } }, '-'
s = [[/r{1}eject/,'collect'],[/\*b{1}ird/,'*word']].reject
puts <<'-'.*(2).tap { |code| s.each { |word| code.sub! *bird } }, '-'
-
puts <<'-'.*(2).tap { |code| [[/\*l{1}augh/,'*half']].each { |half| code.sub! *half } }, '-'
puts <<'-'.*(2).tap { |code| [[/\*l{1}augh/,'*half']].each { |half| code.sub! *laugh } }, '-'
-

Don't pronounce the dashes, they're just there to delimit stanzas. Scansion's not perfect but decent.

\$\endgroup\$
  • \$\begingroup\$ +1 "Reverse the Curse!" would be a catchy title. I'm not crazy about the phrasing, but I got more than half a laugh out of this. \$\endgroup\$ – Scott Leadley Aug 22 '14 at 3:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.