Have you ever been looking for a snippet of F# code for converting an object/from to JSON? For getting a key from the Windows Registry? For defining Perl-style "?" regular expression matching operators? Or hundreds of other common tasks?
The new F# Snippets site by Tomas Petricek now has hundreds of snippets of F# code prepared and entered by the F# community, and more snippets are being added all the time. You'll be able to find all sorts of things here, and what you can't find, you can enter and tag, for the benefit of all F# programmers!
A huge thank you to Tomas for such a wonderful job on this site. Here's Tomas' original announcement, from December.
When writing F# programs, I often write some nice code snippet or some useful helper function that I'd like to share with the F# community. Unfortunately, my blog posts are usually longer and more elaborate, so I never get to blogging about it. Now that I have a twitter (follow me if you don't already) I thought I could just post the snippet somewhere, but there was no good web site for posting F# snippets - until now!
When inserting an F# snippet, the web site runs a compiler on the server, which is relatively slow (so please be patient when posting snippets). Unlike for example pastebin.com or similar pages for posting snippets, the web site targets only F#, but it provides some unique F# features.
The web site is still evolving and I expect to improve it as it becomes more popular. I'll do changes that will look important based on how the web site is used, so feel free to use it and it will adapt to work well :-). One of the first plans is to automatically export all snippets to some source control, so that they are archived in some independent place...
Thanks to Robert Pickering, Antonio Cisternino and James Margetson, the web site already contains a few useful F# snippets in addition to those that I submitted during the development. I think that with your help, the web site can become really useful resource of reusable snippets that solve some of the common problems that F# developers often need to solve. If you ever find yourself thinking that some snippet you just wrote is interesting and could be useful or if you write something when explaining F# to your colleagues, then please go on and post it to the web site! I'm sure I'll do that - I started working on the web site when I got irresistible feeling to share this snippet.
Learn F# Programming at fsharp.net