KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
i'm newbie in haskell, and i have question: i write code: word_list = ["list", "lol", "wordword"] check str = if head str == 'l' then tail str else str average wl = (length $ concat $ map check wl) `div` length wl this code must delete first "l" symbol in every word in word list, concat recieved words, get length of result string and div on words count. so in this code i must recieve: 13 / 3 = 4,333... ("listlolwordword" = 15, "istolwordword" = 13) but i recieve just 4. average :: [[Char]] -> Float don't work, i recieve error. where my mistake? ps. sorry my english, please
Tags (comma-separated)
Save Edits
Cancel