Sha256: 2a3b1e455438cd573029c22e17d1100f04da99abe2a9cfb530116408d4b17bd5

Contents?: true

Size: 317 Bytes

Versions: 129

Compression:

Stored size: 317 Bytes

Contents

module PascalsTriangle

let rows numberOfRows : int list list option = 
    match numberOfRows with 
    | r when r < 0 -> None
    | _ ->
        let row i = 
            [1 .. i - 1] 
            |> List.scan (fun acc j -> acc * (i - j) / j) 1 

        [1..numberOfRows] 
        |> List.map row
        |> Some

Version data entries

129 entries across 129 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.179 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.178 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.177 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.176 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.175 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.174 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.173 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.172 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.171 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.170 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.169 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.167 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.166 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.165 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.164 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.163 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.162 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.161 tracks/fsharp/exercises/pascals-triangle/Example.fs
trackler-2.2.1.160 tracks/fsharp/exercises/pascals-triangle/Example.fs