100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Programming

F# Quick Reference

A condensed cheat sheet of core F# syntax, collection functions, and tooling for fast lookup while coding.

PracticeBeginner7 min readJul 10, 2026
Analogies

Core Syntax at a Glance

F# uses let for immutable bindings, let mutable for mutable ones, -> in lambda and match expressions, and significant indentation, the offside rule, instead of braces. Functions are curried by default, so let add x y = x + y can be partially applied as add 5, producing a new function awaiting the second argument, a building block for point-free, pipeline-friendly code.

🏏

Cricket analogy: Like a quick-reference card showing standard field placements for a fast bowler, the compressed cheat sheet a captain like Pat Cummins glances at: F#'s let, ->, and indentation rules are the compressed cheat sheet for reading any F# function at a glance.

Collections and Common Functions

The core F# collection modules, List, Array, and Seq, each expose consistent operations such as map, filter, fold, sortBy, and iter, with Seq being lazily evaluated for large or infinite sequences, List being an immutable singly-linked list ideal for recursive processing, and Array being mutable, fixed-size, and fastest for random access and interop with .NET APIs expecting arrays.

🏏

Cricket analogy: Like choosing between a Test match squad, List, a methodical, immutable roster for the series, a T20 franchise squad, Array, fixed-size with fast rotation for quick matches, and an ongoing domestic season, Seq, players evaluated lazily match by match: each format suits a different situation.

Modules, Types, and F# Interactive

Group related functions and types with module, define records with { Field: Type } syntax and discriminated unions with type X = CaseA | CaseB of int, and use F# Interactive, dotnet fsi, to load and evaluate script files (.fsx) or paste expressions directly for quick experimentation without a full project build.

🏏

Cricket analogy: Like organizing a cricket board's structure into departments, a men's team module, a women's team module, a domestic module: F#'s module keyword groups related functions and types the same organized way.

fsharp
// Bindings
let x = 42                 // immutable
let mutable y = 0          // mutable
y <- y + 1                 // mutation uses <-

// Functions (curried, partial application)
let add x y = x + y
let addFive = add 5        // partial application

// Records and discriminated unions
type Point = { X: float; Y: float }
type Shape =
    | Circle of radius: float
    | Square of side: float

// Pattern matching
let area shape =
    match shape with
    | Circle r -> System.Math.PI * r * r
    | Square s -> s * s

// Pipelines and collections
[1..10]
|> List.filter (fun n -> n % 2 = 0)
|> List.map (fun n -> n * n)
|> List.sum

Run dotnet fsi from a terminal to launch F# Interactive, then paste expressions and end each with ;; to evaluate immediately, ideal for testing a function or exploring a library API without creating a full project.

Remember that F# curried functions mean add 5 is valid on its own, returning a new function, not a partial-application error; forgetting this can lead to confusing type errors when a function is accidentally under-applied and passed where a fully-applied value was expected.

  • let binds immutable values by default; use let mutable plus <- for mutation.
  • Functions are curried by default, enabling partial application like add 5.
  • List is immutable/linked, Array is mutable/fixed-size and fast for random access, Seq is lazily evaluated.
  • Records use { Field: Type } syntax; discriminated unions use type X = CaseA | CaseB of ....
  • The pipeline operator |> and functions like map/filter/fold/sortBy are core to idiomatic collection processing.
  • F# Interactive (dotnet fsi) lets you evaluate expressions and .fsx scripts without a full build.

Practice what you learned

Was this page helpful?

Topics covered

#Programming#FStudyNotes#FQuickReference#Quick#Reference#Core#Syntax#StudyNotes#SkillVeris#ExamPrep