Wallace
Wallace

Reputation: 17429

In F#, why is there both a List.empty and a List.Empty

In Visual Studio, Intellisense shows both List.empty and List.Empty. What's the difference? Why are they both there?

Upvotes: 5

Views: 611

Answers (1)

Daniel
Daniel

Reputation: 47904

One is a static property of the List type. The other is a function in the List module. They do the same thing. A type with an associated module is a common pattern in F#, and the two frequently overlap, most likely for convenience. Other duplicated members are IsEmpty, Head, and Length.

Upvotes: 10

Related Questions