Reputation: 1702
With most operators in F# I can use prefix or infix notation, for example:
let x = a + b
is equivalent to
let x = (+) a b
This does not work for the exponentation operator ** however, because the parenthesised version is treated as a comment. That is, (*this is a comment*) is F# syntax for a comment, so (**) is treated as an empty comment.
let x = a ** b // a raised to b
let x = (**) a b // empty comment, followed by function a applied to b
Is there an escape character I can use or is this simply a strange quirk of the language?
Upvotes: 10
Views: 1013
Reputation: 4995
Try using spaces between the parentheses, as pointed by kvb in the comments:
let x = ( ** ) a b
Upvotes: 7