Quick Reference – F# Language Constructs

Primitive Expressions

sin(3.1415)

Calling a single-parameter function (parentheses optional)

max 2 4

Calling a function with multiple parameters (3.1.2, 5.5.3)

fst(2, "two")

Calling a function that takes parameters as a tuple (4.4.2)

new System.Random()

Creating an instance of an F# (9.4) or .NET object (4.4.1)

rnd.Next()

Calling an F# member (9.4) or .NET method (4.4.2)

fun a -> a + 10

Creating a function using the lambda syntax (3.4, 5.5.1)

(3, "three")

Creating a tuple value with two members (3.2.1, 5.2)

()

Tuple with zero members; also called unit value (3.1)

Some(10)

Creating a value of a discriminated union (5.3.4)

rnd :> Object

Safe type conversion ...

Get Real-World Functional Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.