Re: [Haskell-cafe] Applying Data.Map

2009-06-09 Thread michael rice
and ! from with the imports I'm using import Data.Map (Map)   (fromList,!)  ??? import qualified Data.Map as Map  (fromList,!) ??? Michael --- On Mon, 6/8/09, Toby Hutton toby.hut...@gmail.com wrote: From: Toby Hutton toby.hut...@gmail.com Subject: Re: [Haskell-cafe] Applying Data.Map To: michael

Re: [Haskell-cafe] Applying Data.Map

2009-06-09 Thread Thomas ten Cate
On Tue, Jun 9, 2009 at 15:23, michael ricenowg...@yahoo.com wrote: import Data.Map (Map)   (fromList,!)  ??? import qualified Data.Map as Map  (fromList,!) ??? Because ! is an operator, you need to enclose it in parentheses. Also, the (Map) in the import is already the list of things you are

Re: [Haskell-cafe] Applying Data.Map

2009-06-09 Thread michael rice
In the import statements, it wasn't clear to me that I could import types as well as functions, and Map is a type. All clear now. Thanks. Michael --- On Tue, 6/9/09, Thomas ten Cate ttenc...@gmail.com wrote: From: Thomas ten Cate ttenc...@gmail.com Subject: Re: [Haskell-cafe] Applying

Re: [Haskell-cafe] Applying Data.Map

2009-06-08 Thread Toby Hutton
Although in this example using Data.Map is overkill, if the alphabet was very large then Data.Map probably would be the way to go. In that case I'd use: map head . group . sort instead of nub . sort since it's noticeably quicker for large lists. This is because nub needs to preserve the order