Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

f#

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

like image 977
Wallace Kelly Avatar asked Jun 13 '14 19:06

Wallace Kelly


1 Answers

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.

like image 77
Daniel Avatar answered Sep 24 '22 20:09

Daniel