English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Q: automatic forgetting cache, module Weak, Gc control
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-07-02 (09:42)
From: Jan Kybic <kybic@f...>
Subject: Re: [Caml-list] Re: Q: automatic forgetting cache, module Weak, Gc control
>    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 Kybic <kybic@ieee.org>                  tel. +420 2 2435 7264
       or <kybic@fel.cvut.cz>,     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