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
OCaml and tail recursion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-12-14 (17:26)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: OCaml and tail recursion
> I have just completed my first nontrival Caml program (an implementation
> of the rsync algorithm) and I am distressed about the treatment of
> tail calls.  My code has to go through files one character at a time,
> and as an SML programmer from way back, I wrote the code using three
> mutually recursive functions that make tail calls to each other.
> Imagine my surprise when I started getting errors with stack overflow!

I'd like to see the code, since ocamlc performs tail calls, of course.
(ocamlopt too, although on some platforms the tail-call optimization
doesn't apply to calls with many arguments, e.g. 8 or more.  But
ocamlc has no such limitation.)

- Xavier Leroy