For example see the following
http://www.artima.com/pins1ed/functional-objects.html
The code uses
val oneHalf = new Rational(1, 2)
Is there a way to do something like
val oneHalf: Rational = 1/2
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.
I would recommend using some other operator (say
\) for yourRationalliteral, as/is already defined on all numeric types as a division operation.