I’m trying a simple F# script that will find pythagoras.
Here’s the code:
open System
let FindHypotenuse a b =
Math.Sqrt(Math.Pow(a, 2.0) + Math.Pow(b, 2.0))
FindHypotenuse(2.0, 3.0)
Any suggestions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ve defined the function to take two curried arguments, but then called it with a tuple. Either call it as
or redefine it to take a tuple
Note that “
'a * 'b” is the name of a tuple type. See also:http://lorgonblog.wordpress.com/2008/04/03/f-function-types-fun-with-tuples-and-currying/