In f# i can easily bind (+) or (*) operators. Why can't I do the same with (**)?
> let s = (+);;
val s : (int -> int -> int)
> let f = (**);;
let f = (**);;
------------^^
C:\Users\mqrx84\AppData\Local\Temp\stdin(4,13): error FS0010: Incomplete structured construct at or before this point in binding
Because (*
*)
are used for multi line comments. You need to separate the parentheses from the operator with whitespace e.g. let f = ( ** );;
To define other operators that begin with *, whitespace must follow the opening parenthesis; otherwise (* is interpreted as the start of a comment: let ( *+* ) x y = (x + y)
From the spec - http://fsharp.org/specs/language-spec/
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