简体   繁体   中英

F# Syntax Question

A bit of a sytax question...

I have the following code in F#

let GetSumOfSequenceAttempt1 : bigint = 
    seq{bigint(1)..bigint(10000000)}
    |> Seq.sum 

I dont what to keep having to place the numbers within the bigint() - is there some shorthand that will make this look neater?

Yes:

let GetSumOfSequenceAttempt1 = 
  seq { 1I .. 10000000I }
  |> Seq.sum 

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