Re: hashmap withdrawal and poor haskell style

Remi Turk
-------------------- module Main where
import Char import FiniteMap
printCount :: (Char, Integer) -> IO () printCount (letter, count) =3D putStrLn $ letter : replicate count '*'
countLetters :: String -> [(Char, Integer)] countLetters letters =3D fmToList $ addListToFM_C (+) emptyFM $ zip letters (repeat 1)
main =3D getContents >>=3D mapM_ printCount . countLetters . filter isAl= pha
this is not exactly the same semantic than the python version, for example if 'z' is not in the contents, then you will not display 'z' (without star) and you will not respect also the order of the letter (i think)
--------------------
Happy Hacking
Remi
--=20 See the light and feel my warm desire, Run through your veins like the evening sun It will live but no eyes will see it, I'll bless your name before I die.
Key fingerprint =3D CC90 A1BA CF6D 891C 5B88 C543 6C5F C469 8F20 70F4
--wRRV7LY7NUeQGEoC Content-Type: application/pgp-signature Content-Disposition: inline
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org
iD8DBQE8qzpFbF/EaY8gcPQRAm8DAJ44i0avXmnavtDu+OOy1mdrBL88HwCfWsx+ GFJUUd1zm1wV8CwfqU2TN0k= =X3DP -----END PGP SIGNATURE-----
--wRRV7LY7NUeQGEoC-- _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Yoann Padioleau, INSA de Rennes, France, Opinions expressed here are only mine. Je n'écris qu'à titre personnel. **____ Get Free. Be Smart. Simply use Linux and Free Software. ____**
participants (1)
-
Yoann Padioleau