Newsgroups: fa.caml
From: Andrej Bauer <Andrej.Ba...@fmf.uni-lj.si>
Date: Mon, 02 Oct 2006 23:03:23 UTC
Local: Mon, Oct 2 2006 7:03 pm
Subject: Re: [Caml-list] More problems with memoization
Diego Olivier FERNANDEZ PONS wrote:
> In my first example you keep the type of [fib] and add a second function If you want to keep the same type for fib, and have the memoized one, as > [fib_mem]. You can use anyone indifferently and hide the latter with the > .mli > val fib : int -> int = <fun> > val fib_mem : int -> int = <fun> well as to have locality you can do something like this: let make_memo f = ... let rec make_rec f x = f (make_rec f) x let fib, fib_mem = (You will notice that make_rec is just the Y combinator.) > When you compare your solution with what I am trying to do you see there I fail to see this big difference, frankly, since all you're doing is > is a big difference in locality and transparency just a beta-reduction of what Jon and I suggested. A recursive function _is_ the fixed point of a non-recursive one with an Andrej _______________________________________________ You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||