A further question about List:
aaa :: [[(Char, Float)]] -> Float -> [[(Char, Float)]]
aaa [[]] a = error "no indata"
aaa [[(a,b)]] c = [[(a, b/c)]]
aaa ([(a,b)]:tail) c = [(a, b/c)] : (aaa tail c)
How to make it work with:
aaa [[('a',3),('b',4),('c',5)],[('a',3),('b',4),('c',5)] ] 4
the result:
[[('a',0.75),('b',1),('c',1.25)],[('a',0.75),('b',1),('c',1.25)]]
how about:
The types in your snippet down match. You try to apply functions defined on float on integers.
You have to pass floats to the functions. That’s why i convert the integers with (fromIntegral y) to floats before applying the floating point division “/” on them. The second argument has to be a floating point number too, so use 4.0 instead of 4.