*
Quick Links|Home|Worldwide
Microsoft*
Search for


NEW: Books on F# Now Available!

These books and other resources deal specifically with F#:

Learning F# by learning OCaml

F# has a core language very similar to that of OCaml, and some of the material for learning OCaml can also be used to help learn F#. For example:

  • Introduction to the Objective Caml Programming Language by Jason Hickey.

  • Objective CAML for Scientists - Jon Harrop's book online.

  • Developing Applications With Objective Caml - "The O'Reilly book" available online. Chapters 2-4 contain introductory material. The text assumes you are using OCaml, and it might make sense to learn OCaml simultaneously with F#, e.g. to type the programs both into OCaml and F#. This means you would have to type the programs into Visual Studio or into a text file and compile/run them. If you type them into Visual Studio you can hover your mouse over identifiers you will see the types that have been inferred for your code. After this things get a little more language specific:

    • Chapter 5 is a simple OCaml graphics application. You can do graphics with F# and there are lots of great samples in the distribution, but to use the code from Chapter 5 you would need an F# implementation of OCaml's "Graphics" module. This would actually be a great mini-project, especially if you're already familiar with .NET's System.Windows.Forms.

    • Chapter 6 contains example applications. They look as if they will work directly, though the first requires the Graphics module.

    • Chapter 7 is about how to use the OCaml command-line compiler and is not so relevant to F#.

    • Chapters 8, 9 & 10 (debugging, profiling, libraries, GC), contain lots of interesting material, but only about half is immediately applicable F# - for example, you can profile F# code, but you would use one of the multi-language .NET profiling tools.

    • Chapter 11 is directly applicable to F#, since lex/yacc generators are supported.

    • Chapter 12 is about interoperability with C code. For F# you interoperate with C code by either importing COM objects (using the .NET tool tlbimp.exe) or by writing some C# code that accesses the C-functions using the excellent C# constructs built for this purpose. The C# manual and .NET tutorial material contains all the information you need on these approaches.

    • Chapter 13 contains further applications, which should be of interest.

    • The remaining chapters deal with modules, objects, concurrency, communication, distribution and applications. All the material is excellent, and well worth looking through, since you'll often find yourself doing the same things in F# and .NET, only slightly differently.

  • Introduction to Functional Programming with OCAML by John Harrison.

  • The Functional Approach to Programming with Caml by Guy Cousineau and Michel Mauny.

  • A Concise Introduction to Objective Caml by David Matuszek.






©2008 Microsoft Corporation. All rights reserved. Terms of Use |Trademarks |Privacy Statement