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
forbidden construct as right hand side of "let rec"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-10-22 (23:10)
From: Lukasz Stafiniak <lukstafi@g...>
Subject: Re: [Caml-list] forbidden construct as right hand side of "let rec"
While we are at it, what is the best way to convert a "straight" list
into a cyclic list?

i.e. convert

let l = a::b::[]


let rec l = a::b::l

(for arbitrary length lists). (The answer I recall from the archives
was using Obj.magic to mutate the [] in the original list).

On Fri, Oct 23, 2009 at 12:34 AM, Stéphane Glondu <steph@glondu.net> wrote:
> Mathias Kende a écrit :
>>       let rec g = f g
> What about:
>  let rec g x = f g x