We can write 3 + 4
or (+) 3 4
in F# and get the same result, and this works for most operators.
Why is it that the cons operator ::
behaves differently? E.g. if I run
(::) 1 [2;3]
I get
error FS0010: Unexpected symbol '::' in expression
whereas I'd want to get [1;2;3].
On a related note, why is List.Cons
not curried? Is there no built-in cons function of type 'T -> 'T list -> 'T list
?