[Haskell-cafe] Re: Grouping - Map / Reduce

2009-03-26 Thread Heinrich Apfelmus
Luke Palmer wrote: On Tue, Mar 24, 2009 at 3:15 PM, Gü?nther Schmidt gue.schm...@web.dewrote: Hi, let say I got an unordered lazy list of key/value pairs like [('a', 99), ('x', 42), ('a', 33) ... ] and I need to sum up all the values with the same keys. So far I wrote a naive

[Haskell-cafe] Re: Grouping - Map / Reduce - blueprint

2009-03-26 Thread Henning Thielemann
On Thu, 26 Mar 2009, Heinrich Apfelmus wrote: Luke Palmer wrote: Yeah, make a trie. Here's a quick example. Nice! There was a thread about this question a few years ago, with some very interesting developments like the blueprint technique by Bertram Felgenhauer.

Re: [Haskell-cafe] Re: Grouping - Map / Reduce

2009-03-25 Thread Martin Huschenbett
Dear Günther, the map can't be consumed while it is constructed. At any point during its construction you don't know for any key in the map if it will appear in the not cosumed rest of the list again. This means you can't process any entry of the map because it may change later. The only

[Haskell-cafe] Re: Grouping - Map / Reduce

2009-03-25 Thread Gü?nther Schmidt
Dear Luke, I'm at a loss trying to figure out what is happening here, I'd sincerely appreciate it if you could find the time to give me more clues on this, I'm deeply impressed. If I think that what is happening *is* happening that would mean that this is a way to group in almost constant

[Haskell-cafe] Re: Grouping - Map / Reduce

2009-03-24 Thread Gü?nther Schmidt
Dear Luke, I suspect Black Magic at work here. This seems to work and I so don't have a clue why. But thank you very much nevertheless, I strongly suspect that, once I figured out why this works, I will have learned a very, very important trick indeed. Had I read purely functional data

[Haskell-cafe] Re: Grouping - Map / Reduce

2009-03-24 Thread GüŸnther Schmidt
Hi Ketil, Ketil Malde schrieb: Gü?nther Schmidt gue.schm...@web.de writes: let say I got an unordered lazy list of key/value pairs like [('a', 99), ('x', 42), ('a', 33) ... ] and I need to sum up all the values with the same keys. So far I wrote a naive implementation, using Data.Map,