Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Perl Programming

Perl Poetry Contest 48

Weeden writes "Leafing through the latest issue of The Perl Journal I came accross the Perl Poetry Contest. The deadline is the 20th of February and all the details can be found here. "
This discussion has been archived. No new comments can be posted.

Perl Poetry Contest

Comments Filter:
  • I actually meant a proper program, something like: 10 a$="10 a$=" 20 q$=CHR$34:b$="20 q$=CHR$34:b$=" 30 b$="40 PRINT a$;q$;a$;q$" 40 PRINT a$;q$;a$;q$ 50 PRINT b$;q$;b$;q$ 60 PRINT d$;q$;d$;q$ But as that is off the top of my head, it kinda doesn't print itself from line 30 onwards - but the code was something like that. IIRC the program (in Micro User IIRC) used functions, procedures, data statements the works - plus it did more than print itself out.
    RIchy C.
    --
  • Who says that coding is not an art form ;-)

    I once did a 1970s version of this - Cobol in rhyming couplets. Just about feasible, but your iambic pentameter goes out of the window.

    You get a flat forehead as well.
  • Oops, guess who forget the tags :( Anyhow... sort it out yourselves, it is a bit off-topic anyhow...
    RIchy C.
    --
  • Perl Poetry has been going on for quite some time. You'll notice that the article sites one of the earlier examples as having been posted in April of 1990.

    I've been trying to write Perl Poems off and on since 1996. I'm trying to write code that functions not only as a poem, but as useful code. That's not as easy as it sounds. I'm definitely going to enter the competition this year. (If they're planning to do this next year, I'll definitely be entering then, too, but with some more sophisticated.)

    As for writing poetry in other programming languages, I have written some Lisp code that I thought was a bit poetic (though by accident) and quite beautiful to look at. I've not tried this in C or C++, but that might be fun, too.

    Contrary to some other opinions expressed here, I don't think writing poetry in a programming language is a waste of time, particularly if the object is to write a poem and not hold it up as an example of good coding practice! I view programming more as an art than a science anyway. Yeah, there's abstract Computer Science with all it's attendant math and theories, then there's the actual ART of programming which EXPRESSES those theories in a LANGUAGE.
  • by Raindeer ( 104129 ) on Monday February 07, 2000 @04:01AM (#1299194) Homepage Journal
    On this website [erols.com] there are some great quotes regarding Perl. My favourites are (Disclaimer: these are not mine, but I claim fair use. :-)) :

    prhine: Advanced Perl Programming is a welcome mat on the Dark Path(tm)

    prhine: D'you know anything about JavaPerl? As in how they combine the two?
    Colin: Well. Imagine that Java is a dainty, well-dressed Victorian lady. And Perl is a big, grimy 10th century viking with a hard-on. JavaPerl is like a small room with a bed.

  • A truly obfuscated program cannot be translated into code that the average programmer can understand. Ever

    Eh ? There was me thinking the Church-Turing Theorem held. Obfuscated code doesn't have to be complex functionaly (just look at some of the hello world contenders in the IOCC) they have to be complex to de-crypt into a quickly understandable form. The functionality has very little to do with the obfuscation.

    A well written set of libraries for 3d graphics will in fact be very easy to understand from a code perspective, it is the functionality that is the tough bit to grasp. Obfuscated code is very different from complex functionality. Look at some of the code in the Linux kernel, wonderfully written, and if you understand the functionality you can modify it yourself, if you don't have a clue what it is trying to do its comparable to russian, this doesn't mean the code is obfuscated, but that the functionality is difficult.

    Difficult code should be difficult to understand because of the functionality it implements not because someone couldn't be arsed to comment it, use sensible names and wanted 40,000 lines to run in one method with gotos.

    Obfuscation is the other end of the scale, its code that is made difficult in and of itself, the difficulty of the functionality is only found after the code has been translated.
  • Well... I think in this case, it would have helped if the moderator had read the _comment_...
  • I know there was a program on the ol' BBC's (and I guess it could be easily ported to RISC OS) which not only rhymed, but also worked. There were also details of programs which would show their own code when ran (without doing any fancy memory tricks), but that's off topic... If only I could find the magazine articles and tweak it so it became rhyming Perl.
    RIchy C.
    --
  • I did see this done in about this much Miranda (or Haskell or something like that anyway).

    I learned about most of how JPG files are formatted. Its a shame I didn't really speak the language, so I still don't quite see how the huffman tree is represented in the file.

    Mp3 should be possible as long as 100% compatibility wasn't required. I've heard that there's a lot of legacy code in there.
  • You can already write them in one line...it just has to be _really_ long.
  • Wow, one of Harl's poems got used as the example. I'm impressed -- he's a really cool guy, and smart as hell. Pasting from an email this morning (sorry Harl):

    > hey, our very own Harl is famous:
    >
    > http://www.itknowledge.com/tpj/perl -poetry00.html [itknowledge.com]

    Wow.

    I doubt I'll be performing in Silicon Valey somehow. The program does sync the disk on a unix system though. I guess system calls are cheating a *bit*. However, I've replaced the sync command on one of my unix machines with this poem as a wrapper, so it runs the poem whenever a sync request is made.

    Harl





  • I'm going to rewrite the entire odyssey in perl and submit it, or maybe just the killing scene. That would be fun.
  • Completely agree, simpler is miles better, but because you choose the simpler path the functionality may still be complex to someone who isn't an expert in that area. I know from looking at some Radar code that what is sensible to people who have studied 4D maths in depth is a mind-bending show to those that haven't. And yet when I understood the functionality I understood the code.

    That is beautiful code, code that allows you to understand functionality, ideally it should teach you the functionality but most importantly it should never hinder you.

    So ladies and gentlemen, use long names, use lots of comparmentalised objects, use many methods on those objects. Don't require callers to understand the internals of methods.

    And remember 99% of the time the compiler writer will do a better job of optimising the code than you.
  • Don't even bother with the huffman. Pipe the quantized bits straight to gzip or bzip2. Bzip2 is better than the standard huffman encoding anyway. I'm assuming one doesn't care about compatability.

    Ryan
  • OK. But both is better!

    Ryan
  • It's called creativity. Being creative is fun. Viewing other's creativity is just as fun.
  • Perl poetry is simply an example of how the perl language has been made to flow naturally like spoken languages, as well as demonstrating that "there's more than one way to do it". While writing useful code that reads as a poem is creative and talented, I don't think anyone is preaching this as a good way to code EVERYTHING. Perl is about getting something done and out of the way, not about taking all day to code a simple function so that it reads like a poem.

    This is just a creative hobby, not good coding.

    Also, I don't think that a perl poem excludes readability as code. Although I don't think the average perl poem is the MOST readable way to do things, if you read it as code rather than as a poem you should be able to get it. Of course, most perl poems toss around extra variables, etc, to add those extra words in, so that would take some figuring out.

  • by Anonymous Coward
    Perl programmers also tend to have a lot of free time

    Sorry couldn't resist.

  • I'm not exactly sure what the difference between this and obfuscating the code is. Its not readable code its unreadable _as_ code but readable as English, a cute idea and a fine basis for a competition, but an awful way of coding. This is just, if not more, evil that obfuscation, unreadable code can be translated, readable code in this manner is misleading which can be worse.

    Okay I know I'm just a kill-joy but the reason the obfuscation competitions are so good is that they make the point against obfuscation so well, this competition appears to be pushing this as a beautiful way to code. Code is beautiful in and of itself, it is its structure that lends beauty and its simplicity that defines genius. Code as poetry is ugly as code, even if it is beautiful as poetry.

  • Umm... Slashdot?
  • by sparkes ( 125299 ) on Monday February 07, 2000 @03:15AM (#1299216) Homepage Journal
    It's pointless trying to port the epic Beowulf over to perl cos anglo-saxon is so similer to perl. It only really differs in its use of the semicolon ;-)

    sparkes
    it was ment to be funny so don't hit my karma for not being a coward.

    *** www.linuxuk.co.uk relaunches 1 Mar 2000 ***
  • You could tip your hand in this contest by getting a set of perl poetry magnets [perltoys.com].
  • We need something that can be read as a poem,
    And also looks nice.
    And is also a functioning program in more than one language.
    And can b typd on a kyboard with no e's
  • I like it!

    These people obviously have way too much time on their hands.

    I have just tried to dash something out and realized just how hard this is. Anyone who can do this really is a poet. It would take a few days to even make a halfway decent haiku.
  • The Quine prints itself
    Spills its source onto the screen
    You get what you had

    Easiest Quine is:
    Using error as code, thus
    getting error back
  • by 348 ( 124012 ) on Monday February 07, 2000 @03:18AM (#1299222) Homepage
    #!/usr/bin/perl
    #
    # Postin.pl
    # by 348

    seek topost (thatflamebait);
    Firstpost (the thread, fast);

    while ($natalie) {
    petrifies $to($stone);
    not grits;
    }

    accept the, moderation;
    seek the, $-1Troll, $-1offtopic'
    and wait;
    stat thekarma;

    unlink and listen (for, $theflames);

    for (a, karmawhore our /.) {
    system ("is trollheaven");

  • by slashdot-me ( 40891 ) on Monday February 07, 2000 @03:47AM (#1299223)
    One significant difference is that obfuscated programs can actually do nifty things. Poetry is generally to restrictive to write anything useful.

    Also, I think you don't understand the nature of true obfuscation. A truly obfuscated program cannot be translated into code that the average programmer can understand. Ever. Good examples are compression programs, 3d graphics, and simulations. Go read the source to an mp3 codec and ask yourself, "Do I have any idea what the tonality function does?" Even after reading that function 10 times you probably won't.

    Understanding a truly obfuscated program will probably require the purchasing of several textbooks.

    Ryan
  • Maybe Rob should make it mandatory for moderators to agree to the following before being allowed to moderate a discussion: "I, John A. Moderator, have read the article linked to from this post."

    From the article: "Choosing the prizes was easy. Winners will receive Magnetic Perl Poetry Kits from Perltoys.com"

    --

  • by Anonymous Coward
    ***Difficult code should be difficult to understand because of the functionality it implements not because someone couldn't be arsed to comment it, use sensible names and wanted 40,000 lines to run in one method with gotos.***

    I have to disagree with you here. Anyone can write code that is easy to understand if it's just doing basic stuff. A talented programmer can write complex code thats just as easy to unserstand. I think it really depends on the style the programmer uses. Some people will choose a super slick convoluted algorithm to show their brilliance when a simple solution would work just as well and actually be maintainable. Whenever the speed of an application is not critical, simple, functional, readable code should always be a high priority.

    I think I relate this to some of the real challenging classes I had in school. Some of my profs made no sense at all when thay explained stuff, while the real good profs could take a complex high level idea and break it down to something that made the light bulb go on in my head with a "Oh yeah... now I get it!"

  • I'm really starting to like these. Perhaps you should put a collection together and publish!
  • by griffjon ( 14945 ) <GriffJon@@@gmail...com> on Monday February 07, 2000 @05:11AM (#1299228) Homepage Journal
    We should bring both the Obfuscated Code and the Perl Poetry contests up in the DVD CCA cases as proof that coding is a form of expression of skill (obfuscated code) and of thoughts, much like language (perl poetry).

  • There once was a hacker named Dan,
    Who interpreted whenever he can.
    He said about Perl,
    Don't calculate Curl!
    That's why we still use Fortran.

    A hacker who coded in COBOL
    was snubbed by his friend who did no BOL:
    "But don't you see, HAL,
    it's all OOP now!"
    ...and promptly got hit by a SNOBOL.

    Thanks, this has potential!
    ---
    pb Reply or e-mail; don't vaguely moderate [152.7.41.11].
  • How about "smallest reimplementation of a bloated standard?" For instance, you can write a lossy image compressor and decompressor that behaves exactly like jpeg in about 300 lines of C. Sure, it won't have quite as many nifty options, but it will be understandable and small. Mp3 probably will take 500 lines.

    BTW, these numbers are completely realistic if you use gzip to do the final lossless compression.

    Ryan
  • Who knows what will happen when technology and English mix. It could get ugly.

    "Your village called THEIR idiot is missing"

    -Trout
  • Have they thought of naming a Perl Poet Laureate?
  • I know of a hacker called Merl
    Who is always programming in Perl
    If he was a man
    He'd use just Fortran
    In fact I think he's a girl.
  • There were also details of programs which would show their own code when ran

    What? like this C64 program:
    10 LIST

Our business in life is not to succeed but to continue to fail in high spirits. -- Robert Louis Stevenson

Working...