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.5 required=5.0 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST,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 B4567BC6B for ; Sat, 4 Aug 2007 11:35:38 +0200 (CEST) Received: from resmaa01.ono.com (smtp.ono.com [62.42.230.12]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l749Zc0I027110 for ; Sat, 4 Aug 2007 11:35:38 +0200 Received: from [192.168.1.33] (83.34.178.87) by resmaa01.ono.com (7.3.118.8) (authenticated as tmp123@menta.net) id 46A5AFDF0040FE6B for caml-list@yquem.inria.fr; Sat, 4 Aug 2007 11:35:30 +0200 Message-ID: <46B4485B.7040406@menta.net> Date: Sat, 04 Aug 2007 11:35:23 +0200 From: tmp123@menta.net User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Sorted list Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 46B4486A.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; elt:01 sugestion:01 modules:02 seems:03 module:03 unit:03 unit:03 identifier:04 problem:05 tmp:05 implement:06 standard:07 generic:08 timer:08 timer:08 Hello, In order to implement a timers subsystem, I need a module with the following values: *) add_timer : time -> ( unit -> unit ) -> timerid, for public usage, where "add_timer t f" means execute "f" at time "t". The result is an identifier who allows cancelation of the timer. *) cancel_timer: timerid -> unit for public usage, cancel a previously added timer *) peek_minimum_timer : unit -> ( time, unit -> unit ) for internal usage, get the timer with minimum time. Returns the time and the related function. *) remove_minimum_timer : ?? -> unit for internal usage, remove the timer with the minimum time. It will be called after execute a timer. Thus, in a generic sense, what I need is a "sorted list", with easy insertion of elements, and peek/pop of the head (minimum). 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.