F# is a simple and expressive programming language. It can be described as statically typed impure functional language that supports functional, imperative and object-oriented paradigm and also several other programming styles including data-driven, event-driven and parallel programming. This makes it an excellent tool for introducing programming as well as programming paradigms. Using F# for teaching has several advantages:

The F# compiler and tools are cross-platform and run using .NET on Windows and using Mono on Mac OS and Linux. F# language is supported in several editors. Aside from the commercial Visual Studio and Xamarin Studio tools, there is an F# mode for Emacs and open-source language binding for MonoDevelop.

Online Teaching and Learning

Try F# is an interactive environment where you can explore F# in your web browser (on Mac and Windows). It contains a number of online tutorials demonstrating the concepts of F#:

Video lectures

Textbooks for Teaching F#

Functional Programming Using F#

Michael R. Hansen and Hans Rischel

This introduction to the principles of functional programming using F# shows how to apply theoretical concepts to produce succinct and elegant programs. Coverage includes advanced features in the .NET library, the imperative features of F# and topics such as sequences, computation expressions and asynchronous computations. The book contains a broad spectrum of examples and exercises.

Further material comprising the programs in the book, lecture slides and mini-projects are found on the book web site.

 

Programming Language Concepts

Peter Sestoft

Programming Language Concepts uses a functional programming language (F#) as the metalanguage in which to present all concepts and examples, and thus has an operational flavour, enabling practical experiments and exercises. It includes basic concepts such as abstract syntax, interpretation, stack machines, compilation, type checking, and garbage collection techniques, as well as the more advanced topics on polymorphic types, type inference using unification, co- and contravariant types, continuations, and backwards code generation with on-the-fly peephole optimization.

Programming Language Concepts covers practical construction of lexers and parsers, but not regular expressions, automata and grammars, which are well covered elsewhere. It throws light on the design and technology of Java and C# to strengthen students’ understanding of these widely used languages. The examples present several interpreters and compilers for toy languages, including a compiler for a small but usable subset of C, several abstract machines, a garbage collector, and ML-style polymorphic type inference. Each chapter has exercises based on such examples.

Lectures and course material