Browse thread
Help with simple ocaml memoization problem
[
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: | -- (:) |
| From: | Peng Zang <peng.zang@g...> |
| Subject: | Re: [Caml-list] Help with simple ocaml memoization problem |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ahhh.. that is helpful. Thanks Jon, Peng On Thursday 29 November 2007 03:08:45 am Jon Harrop wrote: > On Thursday 29 November 2007 05:53, Peng Zang wrote: > > I don't know how to increase the stack size off the top of my head, but > > in general you want to avoid recursion on the stack anyways. An easy way > > is to simply make the function tail recursive so the compiler can > > optimized it into a loop for you. Here's a pretty faithful replication > > of your python code. Note I use Int64 instead of BigInt as I'm running > > OCaml 3.09.3. ... > > let l1 = Int64.of_int 1;; > > let l2 = Int64.of_int 2;; > > let l3 = Int64.of_int 3;; > > OCaml has int64 literals built-in: > > # 3L;; > - : int64 = 3L -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFHTuHxfIRcEFL/JewRAhmoAKDCBN9QvQD5kxQATcOG9Ekj3YDkNQCeLiNl 1aGy4MJSYcMZfpcZY/D2chE= =WzAJ -----END PGP SIGNATURE-----