Version franēaise
Home     About     Download     Resources     Contact us    
Browse thread
Unexpected restriction in "let rec" expressions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Loup Vaillant <loup.vaillant@g...>
Subject: Re: [Caml-list] Unexpected restriction in "let rec" expressions
2008/2/26, Damien Doligez <damien.doligez@inria.fr>:
> The restriction is documented in section 7.3 of the reference manual,
>  and it's here to make recursive definitions work correctly under
>  eager evaluation.

OK, I got it. By the way, replacing "couple" by "couple ()" does the trick:

# let loop f a =
    let rec couple () = f (a, snd (couple ())) in
      fst (couple ());;
    val loop : ('a * 'b -> 'c * 'b) -> 'a -> 'c = <fun>

Now, I have yet to figure out the purpose of this so called "fixpoint
operator" (and if the above will work at all :-).

Thank you all,
Loup