<Query Kind="FSharpProgram" />

let f x = x + 1
let g x = x + x

let a = [|10; 20; 30|]
let b = a |> Array.map f |> Array.map g
printfn "b: %A" b

let b' = a |> Array.map (f >> g)
printfn "b': %A" b'

let s x = [|x+1|]
let t x = [|x+x|]

let c = a |> Array.collect s |> Array.collect t
printfn "c: %A" c

let (>=>) f g = fun x -> x |> Array.collect f |> Array.collect g
let c' = a |> (s >=> t)
printfn "c': %A" c'

(
    let b = a |> Array.map f

    let b' = Array.create a.Length 0
    for i = 0 to a.Length-1 do
        b'.[i] <- f a.[i]
    
    printfn "%A %A" b b'
)