简体   繁体   中英

F# List of random numbers concatenated

Can someone tell me why this works

let createRandomList = List.init 9 (fun _ -> randomNumberGenerator.Next(0,9))
let concatRandomList =
    createRandomList
    |> Seq.map string
    |> String.concat ""

and this does not?

let createConcatRandomList = List.init 9 (fun _ -> randomNumberGenerator.Next(0,9))
    |> Seq.map string
    |> String.concat ""

I am getting an "Incomplete value or function definition" on the second code block

Thanks in advance

在第二个示例中,您需要将|>缩进到与List相同的级别

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM