
On Wed, Dec 21, 2005 at 06:10:56PM +0000, Daniel Carrera wrote:
Daniel Carrera wrote:
Hey,
The sqrt function is not doing what I want. This is what I want:
round sqrt(2)
Sigh... never fails. Spend an hour trying to solve a problem, and a minute after you write to the list you find the solution. I need brackets around sqrt. I'm surprised though. I don't understand why it dosn't work without brackets.
In Haskell parentheses are not part of function call syntax, unlike many languages like C, Pascal or Java. The role of parentheses in expressions is only for grouping and disambiguation. What you typed is actually equivalent to round sqrt 2 which in turn is equivalent to ((round sqrt) 2) because function application is left-associative. Best regards Tomasz -- I am searching for a programmer who is good at least in some of [Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland