Mark Pearl
Mark Pearl

Reputation: 7653

Seq count number of elements

What is the easiest way to count the number of elements in a sequence in F#?

Upvotes: 27

Views: 11212

Answers (4)

Yin Zhu
Yin Zhu

Reputation: 17119

Use Seq.length

Returns the length of the sequence

Upvotes: 54

Brian
Brian

Reputation: 118865

FYI, if you search the library docs for Seq for "-> int" you'll find this rather quickly.

Upvotes: 6

Ankur Gurha
Ankur Gurha

Reputation: 59

you can use Seq.length

Upvotes: 5

Mark H
Mark H

Reputation: 13897

open System.Linq

mySeq.Count()

Upvotes: 8

Related Questions