Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

like image 457
citykid Avatar asked Oct 17 '25 10:10

citykid


1 Answers

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.

like image 107
Fyodor Soikin Avatar answered Oct 19 '25 00:10

Fyodor Soikin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!