In Haskell, there is a function “take n list” which returns the first n elements from a list. For example “sum (take 3 xs)” sums up the first three elements in the list xs. Does F# have an equivalent? I expected it to be one of the List-functions, but I can’t spot anything that seems to match.
Share
Yeah, it’s called
Seq.take. Usage seems to be identical to Haskell’s:Seq.takecount source.To use it on a list, use(Update: Apparently from the comments, this isn’t necessary.)List.toSeqfirst.