I demonstrate the basics of testing F# code with the NUnit unit testing framework. You can also see F# Visual Studio integration and the new F# interactive mode in action (WMV, 5MB); also on Google Video.
There are a few mistakes and slips of the tongue. That's how you know it's totally unscripted and unedited. Don Syme caught the most important ones:
- #I and #r are much smoother ways to reference DLLs, e.g.:
#I @"C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.2904" ;; #I @"C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0";; #I @"C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2905.0";; #I @"C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.05.132" ;; #r @"Microsoft.DirectX.dll";; #r @"Microsoft.DirectX.Direct3D.dll" ;; #r @"Microsoft.DirectX.Direct3Dx.dll" ;; #nowarn "40" // turn off "checked for initialization soundness" warnings
- Custom attributes:
- In my internal version you now also go before “type”, “val”, “exception” and “let” in both .mli files and .ml files. However have just fixed a bug that caused them to be ignored when in this position.
- Using the extension “Attribute” now permitted
- Beware “+” is overloaded on strings as of F# 22.214.171.124, so the following is well-typed!!!
let rec sum l = match l with  -> "" | h::t -> h+ sum t
That last one caught me totally off guard! The keen-eyed will notice that the type error comes from the use of sum.
Unscripted? You're a natural! — Don Syme
Good stuff, thanks! — Aaron
hey Dominic: Its really cool to see the interop of languages at action. kudos! also great to see that we have a F# interpreter finally :). Keep the good stuff flowing. cheers, Vaibhav — Vaibhav
Excellent! How is the beer in Japan? — Adam Granicz
Yes indeed Dominic, how is the beer!? — Don Syme
Hi, I'm very interested in learning about F#. I realize this is an MS-based thing, but I have to say that it is very sad that things like this tutorial are done in such Windows-centric formats. WMV is not friendly to non-Widows folks (yeah, I know, the 0.01% of the world that is non-Widows folks :-). Still, thanks for putting up this tutorial, perhaps some day I'll get a chance to watch it... $0.02, sincerely. — R Duke
too fascinating! — leon