Version française
Home     About     Download     Resources     Contact us    
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: james woodyatt <jhw@w...>
Subject: Re: [Caml-list] let rec
On Wednesday, Jan 15, 2003, at 11:15 US/Pacific, Vitaly Lugovsky wrote:
>
> 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;
>       xprs (il2,anul,ht)
>     and xprs =
>       (Hashtbl.replace ht name (CTfun(f));
>        compile_exprs env2 exprs) in
>     f

I run into the same sort of problem all the time.  It's that 'let rec' 
requires the patten on the left to be a function (okay, there's a weird 
exception, but you don't care about it).

Try this:
	
     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;
       xprs (il2,anul,ht)
     and xprs x =
       (Hashtbl.replace ht name (CTfun(f));
        compile_exprs env2 exprs) x in
     f


-- 
j h woodyatt <jhw@wetware.com>
that's my village calling... no doubt, they want their idiot back.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners