val register : name:string -> age:int -> unit

Full name: index.register
val name : string
val age : int
val printf : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printf
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member GetSlice : startIndex:int option * endIndex:int option -> 'T list
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
val iter : action:('T -> unit) -> list:'T list -> unit

Full name: Microsoft.FSharp.Collections.List.iter
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
val map : mapping:('T -> 'U) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.map
val set : elements:seq<'T> -> Set<'T> (requires comparison)

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.set
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
val filter : predicate:('T -> bool) -> list:'T list -> 'T list

Full name: Microsoft.FSharp.Collections.List.filter
module Seq

from Microsoft.FSharp.Collections
val iter : action:('T -> unit) -> source:seq<'T> -> unit

Full name: Microsoft.FSharp.Collections.Seq.iter
val unfold : generator:('State -> ('T * 'State) option) -> state:'State -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.unfold
union case Option.Some: Value: 'T -> Option<'T>
val take : count:int -> source:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.take

Functionland

A Romance of Many Paradigms

by @troykershaw

(Press 's' to read the story)

ZZZZzzzz....

Pack your bag

Check that FSI is running on your machine.

Beginner
Learn all about values

Intermediate
Help your fellow devs :)

BAM!

Please write a function that takes your name and age and prints them to the console.

Intermediate
Print your name in extravagant ASCII art

Advanced
Do intermediate, but make it print character by character as though it's being typed by a typewriter

Registration

1: 
2: 
3: 
let register name age =
    printf "Name: %s; Age %d" name age
register "Link" 14
1: 
2: 
3: 
Name: Link; Age 14
val register : name:string -> age:int -> unit
val it : unit = ()

King Alonzo speaks

No mutability!

FizzBuzz

FizzBuzz

You must print the numbers 1 to 100 in the console, however, if the number is divisible by 3, print "Fizz", if it is divisible by 5, print "Buzz", if it is divisible by 3 and 5, print "FizzBuzz"

Intermediate
Use active patterns

Advanced
Play "FizzBuzzWoof" where "Woof" is divisible by 7. You must print "Fizz", "Buzz" or "Woof" if any number contains or is divisible by 3, 5 or 7. Words must be printed in the order given in the title.

Cheat sheet

1: 
2: 
for i = 1 to 100 do
    printf "%d" i
1: 
2: 
[1..100]
|> List.iter (fun n -> ...)
1: 
2: 
3: 
match number with
| n when n > 0 -> printfn "Greater than 0"
| n -> printfn "Less than or equal to 0"

Ding! Ding!

FizzBuzz

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
let mutable i = 0

while i < 101 do
    let mutable str = ""

    if i % 3 = 0 then
        str <- str + "Fizz"

    if i % 5 = 0 then
        str <- str + "Buzz"

    if str = "" then
        str <- string i

    printf "%s" str

    i <- i + 1

FizzBuzz

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
let fizzBuzz number =
    match number with
    | n when n % 15 = 0 -> "FizzBuzz"
    | n when n % 3 = 0 -> "Fizz"
    | n when n % 5 = 0 -> "Buzz"
    | n -> sprintf "%d" n

[1..100]
|> List.map fizzBuzz
|> List.iter (printfn "%s")

The Kidnapping

Knight Commander

1: 
type NewRecord = { Property1: string; Property2: int }

Sword and Shield

Create two records, Sword and Shield.

A Sword should have Damage and Durability properties.

A Shield should have Protection and Durability properties.

Then create an instance of a sword and shield using these types.

Intermediate
Create a person record and attach the sword and shield

Advanced Same as intermediate but make new weapons and armour that can replace the sword and shield easily

Sword and shield

1: 
2: 
3: 
4: 
5: 
type Sword = { Damage: int; Durability: int }
type Shield = { Protection: int; Durability: int }

let sword = { Damage = 10; Durability = 1000 }
let shield = { Protection = 5; Durability = 500 }

Escape from prison

The code appears to require 4 digits.

You see fingerprints on the numbers 0, 4, 7 and 9.

What are the combinations you need to try?

Beginner
Let's work this out together

Advanced
Find all the possible combinations

Expert
Find all the possible combinations for 'n' digits

Escape from prison

1: 
2: 
3: 
4: 
5: 
6: 
7: 
let possibilities = [0; 4; 7; 9]
for i in possibilities do
    for j in possibilities do
        for k in possibilities do
            for l in possibilities do
                if i <> j && i <> k && i <> l && j <> k && j <> l && k <> l then
                    printfn "%d %d %d %d" i j k l

Escape from prison

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
let rec combinations acc set = seq {
    match set with
    | [] -> yield acc
    | s ->
        for n in s do
            yield!
                set
                |> List.filter (fun s -> s <> n)
                |> combinations (n::acc)
}

[0; 4; 7; 9]
|> combinations []
|> Seq.iter (printfn "%A")

Print the first 50 numbers in the Fibonacci sequence.

The Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1: 
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

Intermediate
Use an infinite sequence

Advanced
Play code golf

Fibonacci sequence

1: 
2: 
3: 
4: 
5: 
let fibSeq = (1L,1L) |> Seq.unfold (fun (a, b) -> Some(b, (b, a+b)) )

fibSeq
|> Seq.take 50
|> Seq.iter (printfn "%d")

To be continued ...