So, whilst poring through Pickering’s book and browsing through Tomas Petricek’s blog (which has a promising F# AJAX toolkit, which alas, doesn’t work yet) and stealing glances at the O’Reilly online OCAML book, I decided to write some programs to exercise my understanding of the material. After some stumbling, I found Project Euler, a great site full of math programming puzzles.
I solved Problem #1 naively in \~ 10 lines of F# using list comprehensions and recursion (I’ve seen a one-liner using Seq.fold). Problem #2 builds on this and takes about 30, including a debugging function to print results (better solutions, using Seq.unfold, do it in 10). I posted my code solutions to the forum, so as not to spoil anyone else’s fun (you can only post to the forum for that problem after you’ve solved it). It’s very interesting to see all of the other solutions in different languages, and the algorithm discussion is fascinating too.
It’s also quite impressive how easily F# morphs into math problems (though I am still writing some horrid C#/F# hybrid presently).
Oh, and here’s a nifty 100-line podcast downloader, slurppodcasts.
(Note that Idioms.using is no longer necessary, since using is integrated into F#)
Finally, here’s Feedburner’s Planet F#.