From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA15212; Fri, 2 Jul 2004 11:42:30 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA13553 for ; Fri, 2 Jul 2004 11:42:29 +0200 (MET DST) Received: from relay.felk.cvut.cz (relay.felk.cvut.cz [147.32.80.7]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i629gSEV030454 for ; Fri, 2 Jul 2004 11:42:28 +0200 Received: from k333.felk.cvut.cz (k333.felk.cvut.cz [147.32.87.5]) by relay.felk.cvut.cz (8.12.11/8.12.11) with ESMTP id i629g7eT033509 for ; Fri, 2 Jul 2004 11:42:10 +0200 (CEST) (envelope-from kybic@fel.cvut.cz) Received: from K333/SpoolDir by k333.felk.cvut.cz (Mercury 1.48); 2 Jul 04 11:42:11 +0100 Received: from SpoolDir by K333 (Mercury 1.48); 2 Jul 04 11:40:58 +0100 Received: from localhost (147.32.84.19) by k333.felk.cvut.cz (Mercury 1.48) with ESMTP; 2 Jul 04 11:40:57 +0100 To: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] Re: Q: automatic forgetting cache, module Weak, Gc control References: <20040701.174358.116814367.garrigue@kurims.kyoto-u.ac.jp> <1088690342.2582.122.camel@pelican.wigram> From: Jan Kybic In-Reply-To: Date: 02 Jul 2004 11:40:57 +0200 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.93 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-felk: Found to be clean X-MailScanner-SpamCheck-felk: not spam, SpamAssassin (score=-4.9, required 5, BAYES_00 -4.90) X-Miltered: at nez-perce with ID 40E52E04.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 fifo:01 fifo:01 apropriate:01 functorized:01 memo:01 invocation:01 420:99 arrays:01 labels:01 variant:02 variant:02 module:03 obj:03 types:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > there is not enough memory. For efficiency, the FIFO structure will > hold blocks (arrays). As the FIFO structure is global and will have to > hold different types of data, storing Obj.t seems to be apropriate. > > Why don't you use a variant type? Because I do not know how to generate new variant labels on the fly. I want to have a (possibly functorized) factory function memo : ( a -> b ) -> ( a -> b ) such that 'memo f' gives the same results as 'f', only faster, as it will cache the results. Now, 'memo' is used many times in the program, with different functions 'f'. If I store the results in a variant type then for each of the invocation of 'memo' I need to generate a different label. I do not know how to do that. Jan -- ------------------------------------------------------------------------- Jan Kybic tel. +420 2 2435 7264 or , http://cmp.felk.cvut.cz/~kybic ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners