Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] let rec
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Max Kirillov <max630@m...>
Subject: Re: [Caml-list] let rec
On Wed, Jan 15, 2003 at 10:15:48PM +0300, Vitaly Lugovsky wrote:
VL>  It's not so funny. Why I can't write it using let rec:
VL>     let rec f (il,al,ht) =
VL>       let il2 = Array.make (n2+1) Lnil in
VL>       acopy il il2;
VL>       Array.iteri (fun i x -> il2.(all.(i)) <- x) al;
VL>       xprs (il2,anul,ht)
VL>     and xprs =
VL>       (Hashtbl.replace ht name (CTfun(f));
VL>        compile_exprs env2 exprs) in
VL>     f

You may use lazy things:

>     let rec f (il,al,ht) =
>       let il2 = Array.make (n2+1) Lnil in
>       acopy il il2;
>       Array.iteri (fun i x -> il2.(all.(i)) <- x) al;
>       (Lazy.force xprs) (il2,anul,ht)
>     and xprs =
>       lazy ((Hashtbl.replace ht name (CTfun(f));
>		compile_exprs env2 exprs)) in
>     (*optional*) ignore(Lazy.force xprs);
>     f

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: