I have a function declared as
let GetLength (value : option<string>) =
if value.IsSome then value.Value.Length else 0
And I have the variable
let a : string = "tom"
How do I pass a to the function GetLength?
The accepted answer doesn't compile, and produces...
GetLength Some a;;
^^^^^^^^^^^^^^ error FS0003: This value is not a function and cannot be applied
F# thinks you are building a function (GetLength Some)
to apply to the value a
. That is because it's a functional language.
The correct form is
GetLength (Some a);;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With