hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

Use of F# in the Nineth Annual ICFP contest

Last post 07-27-2006, 6:13 by Robert. 3 replies.
Sort Posts: Previous Next
  •  07-23-2006, 9:59 436

    Use of F# in the Nineth Annual ICFP contest

    This weekend was the nineth annual ICFP contest. See http://www.icfpcontest.org/index.shtml

    I entered the contest, and used F# as my programming language.  I wrote the VM using F#, which turned out to be very good for the task. It was easy to write, extend, and debug the code. And the resulting program ran more than fast enough to complete the rest of the contest. The only problem I ran into was that the default UTF8-based output routines munged the binary data that they wrote. (This is a .NET problem rather than a F# problem.) Switching to the BinaryStreamWriter class solved that problem.

    I posted a blog entry about my contest experience here:

    http://grammerjack.spaces.msn.com/blog/cns!F2629C772A178A7C!142.entry

     

  •  07-25-2006, 7:06 439 in reply to 436

    Re: Use of F# in the Nineth Annual ICFP contest

    I had a similar experience in using F# when writing my UM VM.  The support for unsigned integers and bit operations made the instruction decoding easy, pattern matching on an instruction type made emulation easy, and ignoring the fact that the Pervasive input/output functions were designed to munge the data wasted a lot of time.  Compared to other notes I've read from teams that used higher-level languages (vs C/C++), my implementation with just simple algorithms and basic optimizations was fast enough for the rest of the contest, thanks to unboxed integer arrays.  I was able to use FSI to debug my functions and act a basic disassembler (any_to_string is your friend).

    I was less successful in the rest of the contest:  I spent too long on the Basic program (roman numerals are NOT my friends), I spent too long trying either exhaustive or deterministic methods for solving the Black problem, and missed the easy way to get Advise to work.  The most fun I had was writing the simple 2D programs.  My wife worked through many of the Adventure problems by hand.

    This was my first effort in any of the contests, but I wish I did better at the "real" programming tasks.  There is always next year Smile [:)]

  •  07-25-2006, 16:51 443 in reply to 439

    Re: Use of F# in the Nineth Annual ICFP contest

    A small group of us entered here too, though to be honest most of us didn't get much time on it. We'll post our example UM VM around on the Hub in due course, and maybe include it as a sample in the next release. It's performance is better than many C implementations and vastly better than most of the "high-level-language" implementations reported on the ICFP contest mailing list.  There are also a bunch of cool additional hacks that show how to use pinning and unsafe IL to manipulate bytes directly (i.e. effectively programming C in F#)

    I spent my few hours on the last of the 2D problems, modelling the constructs in F#.  I'm amazed how effective "any_to_string" and "output_any" are: they save hours in prototyping time.

    Don

     

  •  07-27-2006, 6:13 446 in reply to 443

    Re: Use of F# in the Nineth Annual ICFP contest

    I was particularly aware the contest was going on, although it sounds like fun. Maybe we could get together a hub team next year? Although this could be problematic as we are spread over a fair few geographic locations.


    Robert Pickering, MVP
    http://strangelights.com
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems