I don't understand why this won't load into the interactive Haskell interpreter. When I type the function definition directly into GHCI it works just great. But when I try to load the function definition from a .hs file, that's when I get an error message. Any ideas? Thanks for the help.
let partialsums lst = reverse ( partial_sums lst 0 [] ) where
partial_sums ls accum accumulator_list =
if ls == [] then accumulator_list else
partial_sums ( tail ls ) ( accum + head ls )
((accum + head ls) : accumulator_list)
I've tried this same function definition in Python, Ruby and Ocaml. No problems at all! ( Python's whitespace rules are simple and intuitive. Ruby and Ocaml do not read whitespace. In those languages whitespace is strictly there for the convenience of the person reading the program. But I think Haskell has some pretty strict whitespace rules that I'm not familiar with. )
Thanks for the help. Haskell sure looks interesting, but it's a hard, hard language to learn without the supervision or guidance of a good professor. I'm just trying to learn the language on my own.