F#函数运行时没有被调用

Gab*_*iel 3 .net f#

这段代码

open System.Threading

let duration = 1000

module SequentialExample =
    let private someTask item =
        printfn "oh god why"
        Thread.Sleep(duration)
        item + " was computed"

    let private items = [
        "foo"
        "bar"
        "baz"
    ]

    let getComputedItems = 
        printfn "heh"
        [for item in items -> someTask item]
        |> Array.ofList

module ParallelExample =
    let private someTask item =
        printfn "that's ok"
        Thread.Sleep(duration)
        item + " was computed"

    let private items = [
        "foo"
        "bar"
        "baz"
    ]

    let getComputedItems = 
        Async.Parallel [for item in items -> async { return someTask item }]
        |> Async.RunSynchronously

[<EntryPoint>]
let main args =
    ParallelExample.getComputedItems |> ignore
    0
Run Code Online (Sandbox Code Playgroud)

有以下输出:

heh
oh god why
oh god why
oh god why
that's ok
that's ok
that's ok
Run Code Online (Sandbox Code Playgroud)

如果我正在调用ParallelExample模块,为什么F#在SequentialExample模块中运行代码?

我究竟做错了什么?

Gab*_*iel 8

正如John Palmer在评论中所说, let getComputedItems = ... 实际上是一个值,而不是一个函数,因为函数必须采用一个参数.

要使它成为一个函数,必须声明它 let getComputedItems () = ....