Browse thread
More problems with memoization
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-10-01 (00:51) |
From: | Martin Jambon <martin1977@l...> |
Subject: | Re: [Caml-list] More problems with memoization |
On Sun, 1 Oct 2006, Jon Harrop wrote: > I believe you want to "untie the knot" of recursion, creating an higher-order, > auxiliary fibonacci function fib_aux that accepts the recursive call as an > argument: > > # let rec fib_aux fib = function > | 0 | 1 as n -> n > | n -> fib(n - 1) + fib(n - 2);; > val fib_aux : (int -> int) -> int -> int = <fun> Since the point is to make the function not recursive, I think you shouldn't use "let rec" :-) Martin -- Martin Jambon, PhD http://martin.jambon.free.fr