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 to a base class (9.4.2) |
someObj :?> Random |
Dynamic type cast to a derived class or interface (9.4.2) |
someObj :? Random |
Dynamic type test returning a Boolean value (9.4.2) |
if n > 0 then +1 else -1 |
If expression that returns a value of type int (2.2.4) |
if n > 0 then printf "+" |
Imperative if expression that returns a unit value |
10::[] |
Creating a list with a head (value) and a tail (list) (3.3.2) |
[3; 9; 4; 2; 5; 5 ] |
Creating a list by enumerating elements (3.3.2) |
[| 1 .. 20 |] |
Creating an array from a number sequence (10.2.3) |
buffer.[n] |
Accessing the nth element of an array (10.2.3) |
seq { yield 10 } |
Creating a collection using sequence expression (12.1.3) |