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
Help with simple ocaml memoization problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-29 (08:17)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Help with simple ocaml memoization problem
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

Dr Jon D Harrop, Flying Frog Consultancy Ltd.