Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 <>                  tel. +420 2 2435 7264
       or <>,

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: