I have been trying
Hugs98
This is the average of
floats list calculation program:
================================
accum :: [Float] ->
Float
accum list = foldr (+) 0 list
my_avg list = (accum list) / (length
list)
================================
While loading it I got
the compiler message:
ERROR
"U:\slav\FP\Avg.hs":11 - Type error in application
***
Expression : accum list / length list
***
Term : accum
list
*** Type :
Float
*** Does not match : Int
Why "accum list" should
match to "Int"?
When I try to replace (length list) with
number - it works.
================================
my_avg list =
(accum list) / 5 --works fine
================================
xx =
5
my_avg list =
(accum list) / xx --doesn't work
-- same message as above
================================
Possibly, I don't know something important, or Hugs is not quite
mature?
Thank you.
Slav.