You are not logged in.
I started to learn haskell and the 1st thing i tried is to define a function. I tried it both in hugs and in hsci:
Prelude> square x = x * x
<interactive>:1:9: parse error on input `='
the same (more or less) happens in hugs.
I'm lost here, how do i define a function?
Thanks!
Last edited by drakosha (2007-02-01 12:56:05)
Offline
at the interpreter, you need to precede definitions with a 'let'. e.g.,
let square x = x*x
you should think of the interpreter prompt as running inside a 'do' block.
Offline
10x!
Offline