Calling BCL functions with tuple arguments in F?

Try this instead: let rndNumber = range |> rng. Next I think the lack of type information at the point of the method call is causing it to default to the first overload (accepting int). If you pipe your argument to it, it knows which overload you want.

Works! Although quite ugly.. – devoured elysium Aug 15 '11 at 17:05 4 Stare at it until it looks beautiful--it's the F# way. :-) Piping is necessary all over the place because of top-to-bottom/left-to-right type inference.

– Daniel Aug 15 '11 at 17:09 Yes, I already had came to the conclusion that F# is everything but pretty (at least in comparison with haskell). Oh well, we can't have it all.. Btw, isn't there any other way of giving the clue to the compiler? – devoured elysium Aug 15 '11 at 17:13 Yes, you can do let rndNumber = (rng.

Next : int * int -> int) range instead. – Daniel Aug 15 '11 at 17:17 let rndNumber = (rng. Next : _*_->_) range works too – Stephen Swensen Aug 15 '11 at 17:46.

You could have a . NET method overload that takes a single argument of type System. Tuple as well, which complicates matters.In general, F# looks at the call site of the method, and syntactically determines which overloads to try.

When you call o. M aTupleVar F# tries to find a method taking a single argument (that is a tuple), as opposed to multiple arguments. The "piping" workaround Daniel suggested works because there is no syntactic call to a method, so F# just resolves rng.

Next to the overload group of methods with that name, and resolves the call later. That said, there is almost never a reason in practice to do this. If you're going to call a .

NET method, do it directly with o. M(arg1,arg2), there is rarely a need/desire to create a tuple first.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions