On 2005-12-21 at 18:10GMT 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.

Elementary syntax. Function application needs no parentheses
and associates left, so

   sqrt 2

is fine, and what you wrote means

  (round sqrt) 2

whereas what you want is

   round (sqrt 2)


-- 
Jón Fairbairn                              Jon.Fairbairn at cl.cam.ac.uk


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to