Re: [Haskell-cafe] Re: TChan implementation: Why TVarList

2005-12-06 Thread Bulat Ziganshin
Hello Joel, Tuesday, December 06, 2005, 2:46:24 PM, you wrote: JR> I need to implement a mailbox where messages can be pulled out based JR> on a predicate or in order of arrival. I'm thinking of using a Map JR> keyed on ClockTime. JR> Do you have any suggestions? it depends. what is the usage

Re: [Haskell-cafe] Re: TChan implementation: Why TVarList

2005-12-06 Thread Joel Reymont
I think I could fake it on top of Data.Map keyed on ClockTime. findMax :: Map k a -> (k, a) O(log n). The maximal key of the map. This would give me the maximum key which I can then proceed to remove. On Dec 6, 2005, at 12:35 PM, Simon Peyton-Jones wrote: sounds as if you need a priority que

RE: [Haskell-cafe] Re: TChan implementation: Why TVarList

2005-12-06 Thread Simon Peyton-Jones
sounds as if you need a priority queue, so you can say "give me the message with the earliest time" but otherwise yes. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joel | Reymont | Sent: 06 December 2005 11:46 | To: Simon Peyton-Jones | Cc: H