From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.2 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST,HTML_MESSAGE,MAILTO_TO_SPAM_ADDR,MIME_HTML_ONLY, NO_REAL_NAME autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 0D5BDBC6B for ; Sat, 4 Aug 2007 17:17:17 +0200 (CEST) Received: from resmaa03.ono.com (smtp.ono.com [62.42.230.12]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l74FHGY9010560 for ; Sat, 4 Aug 2007 17:17:16 +0200 Received: from [192.168.1.33] (83.34.178.87) by resmaa03.ono.com (7.3.118.8) (authenticated as tmp123@menta.net) id 46AEF823001AC482 for caml-list@inria.fr; Sat, 4 Aug 2007 17:17:10 +0200 Message-ID: <46B49875.3070206@menta.net> Date: Sat, 04 Aug 2007 17:17:09 +0200 From: tmp123@menta.net User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: ocaml ml Subject: Re: [Caml-list] Sorted list References: <46B4485B.7040406@menta.net> <46B454ED.700@philippewang.info> <1186226538.14440.105.camel@rosella.wigram> In-Reply-To: <1186226538.14440.105.camel@rosella.wigram> Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 46B4987C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0200,:01 elt:01 sugestion:01 unit-:01 sugestion:01 pointers:01 wrote:01 wrote:01 integer:01 caml-list:01 functions:01 modules:02 seems:03 seems:03 unit:03 skaller wrote:
On Sat, 2007-08-04 at 12:29 +0200, Philippe Wang wrote:
  
tmp123@menta.net wrote:
    

  
Of the standard modules, the most similar seems "set", because allows 
insertion and has the funcion "min_elt". However, the problem is, if 
two timers have the same time, addition of the second one removes the 
first.

Please, has someone any sugestion?

Thanks a lot.
      
You must keep a list of functions to fire off at a given time,
so the map will be

	time -> timerid list

and you'll also need timerid -> time * (unit->unit) to fetch the
function from the id.

  
Hello,

Thanks for the sugestion.

It seems dificult to generate an unique identifier, for this subject or any other (in this sense, I feel nostalgic of the old C pointers).

An integer counter could be valid, but, when the counter reaches the maximum, the counter needs to return to "0". From now on, before to return a new identifier, it should be checked if this value is already in use. And that means O(n).

I do not see solution for that.

Kind regards.