Before you begin

This is a F# language class. To complete the coding exercises, you will need a Xamarin development environment (Mac or Windows) to run the exercise on. Please read the setup requirements if you need help installing the Xamarin development environment.

Overview

This class is designed to introduce you to the F# language. We will cover why F# is such an important language to learn, as well as some of the fundamentals of the language.

Lecture

FSC101 - Introduction to F#.

Objectives

  1. Explain why F# is important
  2. Execute F# code in the REPL
  3. Working with expressions and loops

Exercises

Exercise materials are available from GitHub. The code can be cloned through a desktop Git client or downloaded directly as a ZIP file.

  1. Discover the REPL
    Exercise
    In this exercise, you will discover the convenience of working inside the F# REPL.
  2. Working with immutable and mutable values in the F# REPL
    Exercise
    In this exercise, we will explore mutable and immutable values, and how the F# language reacts to both of them.

Additional Resources

F# syntax

Microsoft has extensive documentation on the F# language, you can start with the F# Language Reference (MSDN), or read through the Xamarin documentation on F#. Alternatively, you can read through a F# to C# Comparison, or a quick overview of F# syntax.

Type safety

F# is a statically typed language which provides great type safety features for the programmer. One of the interesting features we talked about in this class was the type safety supported for printfn.

Lambdas and anonymous functions

In order to use many of the list and array operations, you must understand anonymous functions. Most of you will be familiar with this concept already through C#'s lambdas. You'll find the F# syntax is quite similar.

Further Reading

Async and Parallel Design Patterns in F#: Parallelizing CPU and I/O Computations Immutability (and why it's important)