А не проще
Code
import Control.Monad
ver simbol l acc text =
case l of
l1:ls -> if simbol == l1 then ver simbol ls (acc+1) text else ver simbol ls acc text
[]-> acc / (fromIntegral $ length text)
prob simbol text = ver simbol text 0 text
loge2 = log 2
log2 a= log a/ loge2
inf n text = if (prob n text) == 0 then 0 else (-1)*(prob n text)*(log2 (prob n text))
iinf l text=
case l of
l1:ls-> (inf l1 text)+(iinf ls text)
[]->0
main = do
print $ iinf ("mama myla ramu") ("mama myla ramu")
?Добавлено (01.12.2010, 18:59)
---------------------------------------------
Хмм....Интересно, а захрен у меня import Control.Monad?))