Search code examples
f#sequencenaming

Why F# seq starts with small letter?


I am new to F# and I noticed that all other collection types start with a capital letter except for sequences. Is this because the seq is actually merely an alias for IEnumerable and not an actual new F# type like the other ones?

Thank you.


Solution

  • In F#, a sequence can expressed via the built in computation expression named "seq". Computation Expressions are by convention lower case. You can define your own computation expressions in upper case, but convention is lower case.

    seq - when used as a computation expression - is not an alias for IEnumerable, but seq will create an IEnumerable.

    But there are more meanings of seq as clarified in the comments.