The F# Samples
Links: Up F# Home
F# Library
Note: Building the samples in-place under Windows Vista requires either Visual Studio or your command prompt to be started with Administrator Privileges. Do this by right-clicking on the relevant shortcut, choosing "Properties / Shortcut / Advanced" and setting "Run as administrator".
The samples documented here illustrate the use of F# for
a range of programming tasks.
- The Samples101
sample is a small GUI program that guides you through the a range
of straight-forward mini-samples using F#. You can build it with
build.bat. (Runs on: Windows/.NET 2.0)
- The SimpleForm
sample shows how to declare a simple Windows Form. Can be run
(Mode: Interactive or Compiled, Runs on: any CLI, including Mono).
The WinForms
samples will cover common WinForm controls
via small examples.
(Mode: Interactive or Compiled).
(Runs on: any CLI, including Mono)
- The WebCrawl
sample shows how to fetch web pages and RSS synchronously and
asynchronously, displaying the results interactively.
(Mode: Interactive, Runs on: any CLI, including Mono)
- The famous F# DirectX Demo shows
how to do interactive visualization of moving 3D surfaces and simulate motion on these surfaces.
This is for use with the Managed DirectX libraries for 2D and 3D graphics,
sound, music and other exceptionally cool stuff.
(Mode: Interactive, Runs on: Windows/.NET 2.0 with Managed DirectX Runtime)
- The Getting Started with WPF in F# Interactive
is a micro helper-sample to give you the essential script you need to get going with using WPF from F# Interactive.
(Mode: Interactive, Runs on: .NET 2.0 with .NET 3.0/WPF installed)
- The FLinq
sample shows how to use F# quotation meta-programming in conjunction with the
LINQ libraries for strongly typed, programmatic database and data transformation.
As of F# 1.1.15 the 2006 May CTP edition of LINQ is required.
(Mode: Compiled, Runs on: Windows/.NET 2.0 with LINQ)
- The Web samples, e.g. ASP.NET 2.0 sample.
- The DirectX Tutorials
The mini-tutorials were
provided by Jack Palevich.Tutorial 1 shows how to create a DirectX device for use with a
Windows form. Tutorial 3 is
a basic introduction to the matricies used to specify 3D scenes.
Tutorial 6 introduces meshes and textures.
Interactive/script.fsx scripting sample shows
another example of using DirectX
with the F# Interactive top level fsi.exe.
However the 3D Interactive DirectX demo is really much more fun.
(Mode: Compiled, Runs on: Windows/.NET 2.0 with Managed DirectX Runtime)
- The Concurrent Game of Life
sample shows how to write a multi-threaded GUI for
simulation-like computations in F#. It is an
advanced sample that demonstrates some of the powerful
and unique features of F#. In this release it is written using the experimental 'light' syntax.option
(Mode: Compiled, Requires: .NET 2.0, Runs on: Windows/.NET 2.0)
- The Parsing
sample shows how to use the fsyacc and fslex tools to
build parsers and lexers for use with F#.
(Mode: Compiled, Runs on: any CLI, including Mono)
- The TermWalker script
sample shows how to use the F#-specific augmentation to
the .NET reflection library to write generic algorithms
to walk F# terms, in this case to assess the degree of leaf-node
sharing in a term graph.
(Mode: Interactive, Runs on: any CLI, including Mono)
Older samples:
- The SimpleInterop
sample shows how to call F# from C# and vice-versa.
(Runs on: any CLI, including Mono)
- The Sockets
sample shows how to write a simple 'echo' server that
will accept multiple client connections via sockets
and simply sends back data to the client.
(Runs on: any CLI, including Mono)
- The TypeFinder
sample shows how call .NET reflection libraries from F#.
(Runs on: any CLI, including Mono)
- The AsyncDelegates
sample shows how to create and execute asynchronous
F# code, to be managed by the .NET Thread Pool.
(Runs on: Windows/.NET 2.0)
- The VideoPlayer
sample shows how to call the Quartz video-playing COM component.
(Runs on: Windows/.NET 2.0)
- The Automation samples
show that it
is possible to use the Microsoft Word and
Excel 'Automation' APIs from F# to script these programs.
You even get to control Excel and Word through F# Interactive!
More recent versions of Microsoft Office include
strongly typed .NET APIs.
(Runs on: Windows/.NET 2.0, Requires Microsoft Office)