If I am using reference tuples, this compiles:
let plot(x: int, y: int) = ()
let point = 3, 4
plot(fst point, snd point)
However, if I am using struct tuples...
let plot(x: int, y: int) = ()
let point = struct (3, 4)
plot(fst point, snd point)
... I get the compiler error, One tuple type is a struct tuple, the other is a reference tuple
What should I do?
There's a ToTuple()
extension method in System.TupleExtensions
for ValueTuple<T1, T2...>
.
You could just call:
plot (point.ToTuple())
As for fst
, snd
, they're bound to System.Tuple<>
, so maybe you could define an alternative:
let fstv struct (a,_) = a
let sndv struct (_,b) = b
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