Is it possible to define the ** operator in F#

80 Views Asked by At
let (**) ls1 ls2 = List.intersect ls1 ls2

does not work because (**) is considered a comment. Is there any escape possibility?

1

There are 1 best solutions below

0
On BEST ANSWER

You can add whitespace inside the parentheses, like this:

let ( ** ) ls1 ls2 = List.intersect ls1 ls2

Keep in mind, however, that ** is a standard F# operator for "power":

2 ** 3 = 8

So if you redefine it like this in the global context, you will not be able to use it in the "power" sense.