F# is an actively used programming language created in 2005.

14Years Old 49,233Users 2Jobs

Example code from the Hello World Collection:

(* Hello World in F# *)

printf "Hello World!\n"

Example code from Linguist:

module Sample

open System

type Foo =
    {
        Bar : string
    }

type Baz = interface end

let Sample1(xs : int list) : string =
    xs
    |> List.map (fun x -> string x)
    |> String.concat ","

Example code from Wikipedia:

/// A simple prime number detector
let isPrime (n:int) =
   let bound = int (sqrt (float n))
   seq {2 .. bound} |> Seq.forall (fun x -> n % x <> 0)

// We are using async workflows
let primeAsync n =
    async { return (n, isPrime n) }

/// Return primes between m and n using multiple threads
let primes m n =
    seq {m .. n}
        |> Seq.map primeAsync
        |> Async.Parallel
        |> Async.RunSynchronously
        |> Array.filter snd
        |> Array.map fst

// Run a test
primes 1000000 1002000
    |> Array.iter (printfn "%d")
Edit

Last updated February 11th, 2019