Slashdot Mirror


ICFP 2001 Task

David Mentré writes: "The ICFP 2001 programming contest TASK is now available. The objective is to write an optimizer (aka compressor) for an HTML-like language. It must work for arbitrarily big inputs and in a limited wall-clock time. Can you guess what will be the winning language? ;)" We already announced the contest, but now that the task is available, it might be fun to look at. So what will the contestants come up with? Anyone think perl might be the language of choice? :)

19 of 110 comments (clear)

  1. Scheme/Lisp by DGolden · · Score: 3

    Just to point out, there's a good functional XML parser/processor available for Scheme - as everyone here knows, XML is just a verbose way of writing certain Lisp S-Expressions. This software will allow you to load any XML in as a lump of Scheme, and it can then be treated like any other Scheme data structure you've been taught how to process in CS 101. See www.lh.com/~oleg/ftp/Scheme/xml.html

    for example: <WEIGHT unit="pound">
    <NET certified="certified"> 67 </NET>
    <GROSS> 95 </GROSS>
    </WEIGHT>

    becomes:
    (WEIGHT (@ (unit "pound"))
    (NET (@ (certified)) 67)
    (GROSS 95)
    )

    --
    Choice of masters is not freedom.
  2. How about.... by ChrisBennett · · Score: 4

    Java?
    Anyone? Ok, I'm actually serious, don't mod me up +1 Funny.

  3. Re:What about XML/XSL? by Simon+Brooke · · Score: 3
    Sorry to upset the apple-cart, but might a combination of XML and XSL challenge the dominance of Perl? I'm afraid I am not suffinciently advanced in these languages to bet on them, but I reckon they would give the other contenders a run for their money.

    No.

    XML is not a programming language, it's a markup language. You can't use it to compute anything. XSL-FO is not a programming language, it's a page description language. You can't use it to compute anything. XSL-T is a programming language, and a very elegant one, but it isn't (IMHO) well suited to this task, and certainly would not produce a compact output.

    --
    I'm old enough to remember when discussions on Slashdot were well informed.
  4. And the winner is... by Pseudonym · · Score: 5

    I predict that the winner will probably be O'Caml, and for one reason only: it will beat the time limit. Moreover, this will have little to do with the speed of the O'Caml implementation.

    Your program has to complete within a given wall time (not CPU time). This is supplied as a command-line argument and environment variable. The winner will be the tool which can stop computing before the time is up and produce the output. The winning program will be one that iteratively improves the input string, but is monitored by another thread which stops the optimiser thread when the time is almost up, then grabs the best solution so far and performs the output.

    O'Caml just happens to have good built-in primitives to write this kind of "interrupt the thread when the time is up and let me know what you did" computation.

    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    1. Re:And the winner is... by Sapien__ · · Score: 3

      You can do this easily in other languages too, such as alarm() in C (and Perl too!)

  5. Re:Who will win? Look at past years: by selectspec · · Score: 4

    Thats because all of the good C engineers have jobs and are too busy to fsck around with stupid games like this. Caml programmers bored from a lack of any employment in the real world had no problem finding the time to dedicate to this problem.

    --

    Someone you trust is one of us.

  6. Re:Doesn't sound too hard... by Mr.+Sketch · · Score: 3

    You're missing the fact that the tags have to be paired. Ensuring the tags are paired isn't a problem, but ensuring the tags are paired optimally is where the difficulty arises.

    Consider: <B><I>Hello</I></B>World&l t;B><I>Foo</I></B>
    Should be: <B><I>Hello<PL>World</PL>F oo</I></B>
    But how do you know if it's more optimal to go with a PL tag vs closing the B and I? You would need the array to go further down and see that you will need the B and I again so you don't bother to close it.

    This is the problem I'm running in to now :). I'm writing my entry in Haskell and I have a fairly decent optimizer except for these cases and it's currently a 110 line Haskell program.


    --BEGIN SIG BLOCK--
    I'd rather be trolling for goatse.cx.

  7. If you need me... by Nastard · · Score: 5

    If you need me, I'll be doing a preliminary victory dance over in the QBASIC camp...

  8. Re:Any language will do by stilwebm · · Score: 3

    Anyhow, speed will be the deciding factor on this one.

    I'll be pretty surprised if speed ends up being the deciding factor, at least for the first few places. This is a pretty complex problems with many ways you can optimize certain aspects, like overlap inversion, color nestsing, redundency elimination, etc. But to really minimize the size of the output file (the most important factor after qualification and validity) contestants have to come up with a great balance of optimizing all of those factors together. Because it of time constraints, contestants cannot effectively run multiple attempts across all optimizations to find the single smallest output (this would run in exponential time, so small inputs might work, but large ones would run for days). The winners will likely have the best algorithms for optimizing the output in some kind of polynomial time, regardless of the language used.

  9. Re:no ++ by Sapien__ · · Score: 5
    Umm... from the website:

    This programming contest is being conducted by ICFP, which implies a context of functional programming. However, rather than debate the definition of a "functional programming language," we will allow submitted programs to be written in any language whatsoever, as long as it has an implementation for Pentium PCs running Linux. Mixing languages is entirely acceptable; perhaps you will write in Caml and Haskell, with a Tcl script to do the gluing.

    ie, it doesn't have to be a functional programming language.

  10. Mercury by cthugha · · Score: 3

    As far as time limits are concerned, may I suggest Mercury. It's a functional/logical hybrid that's somewhat unorthodox for VHLLs in that it's a compile-only rather than interpreted-only or interpreted/compiled. Its designers claim that it can get similar performances to programs of similar functionality written in C, alhtough I haven't seen any benching, and I'll believe it when I see it. :)

    Anyone think perl might be the language of choice? :)

    No, because Perl isn't a functional language. *sigh*.

  11. SML/NG by Godwin+O'Hitler · · Score: 3

    Did anyone else spot the similarity between the name of their mark-up language and another language?

    --
    No, your children are not the special ones. Nor are your pets.
  12. Who will win? Look at past years: by brlewis · · Score: 5
    2000
    1. PLClub submitted two separate entries using OCaml, either of which would have won the contest.
    2. Camls 'R Us took second place.
    3. Galois Connections took third with their Haskell entry.
    4. The Merry Mercurians took fourth with their Mercury entry.
    1999:
    1. Camls 'R Us mopped up the competition with their 3585-line OCaml entry
    2. The 1250-line Haskell Entry that took 2nd place was written in a mere 24 hours.
    1998:
    1. First prize was a Cilk entry. Winning the contest doesn't seem to have made the language take off in popularity.
    2. Second prize: an OCaml entry ``beat out 23 C and C++ entries, many of these being highly tuned programs produced by extremely competent programmers skilled in game-playing algorithms.''
  13. innovation by rfsayre · · Score: 3

    Thanks to relentless innovation from Redmond, the choice is clear. A team working in Visual Basic will clearly triumph.

    Art At Home

  14. Re:this story is gay by Patrick+May · · Score: 5

    You mean this story is thin, neat, and dresses well?

  15. Just to torture myself by strictnein · · Score: 3

    I think I'll use Scheme

    1. Re:Just to torture myself by SilentChris · · Score: 3
      I might try to hack it in assembler on my TI-99/4A. :)

      By the way, what exactly do we win if we have the best entry?

  16. Python Team by crealf · · Score: 4
    A Python team is trying to solve the task:

    Everyone is welcome.

  17. This is easy... by gnovos · · Score: 3

    print "
    <HTML>
    <HEAD>
    <TITLE>404 Not Found</TITLE>
    </HEAD>
    <BODY>
    <H1>Not Found</H1>
    The requested URL was not found on this server.
    </BODY>
    </HTML>";

    --
    "Your superior intellect is no match for our puny weapons!"