|
|
|
|
|
by wyager
4194 days ago
|
|
Cool! Since we're suggesting changes, here's what I'd do. (Not that anything is wrong with the OP's code, just that it's good to point out all the different stylistic techniques you can adopt.) 7. alphabet = ['a'..'z']
8. nWords = B.readFile "big.txt" >>= return . train . lowerWords . B.unpack
or: 8. nWords = train . lowerWords . B.unpack <$> B.readFile "big.txt"
Make `splits`, `deletes`, etc. values (not functions). `splits` has access to `w`, so there's no need to pass it as an argument 4 times (or even to pass `w` as an argument to the other functions). 27. sortCandidates = (sortBy (flip (comparing snd))) . M.toList
|
|