O'Reilly logo

Real-World Functional Programming with Examples in F# and C# by Jon Skeet, Tomas Petricek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required