From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA26334; Thu, 8 Aug 2002 14:11:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA26298 for ; Thu, 8 Aug 2002 14:11:52 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g78CBpn19552 for ; Thu, 8 Aug 2002 14:11:51 +0200 (MET DST) Received: from ibm3.cicrp.jussieu.fr (ibm3.cicrp.jussieu.fr [134.157.15.3]) by shiva.jussieu.fr (8.12.5/jtpda-5.4) with ESMTP id g78CBpjR002978 for ; Thu, 8 Aug 2002 14:11:51 +0200 (CEST) Received: from ibm1.cicrp.jussieu.fr (ibm1.cicrp.jussieu.fr [134.157.15.1]) by ibm3.cicrp.jussieu.fr (8.8.8/jtpda/mob-V8) with ESMTP id OAA05328 for ; Thu, 8 Aug 2002 14:09:59 +0200 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda/mob-v8) with SMTP id OAA54908 for ; Thu, 8 Aug 2002 14:08:59 +0200 Date: Thu, 8 Aug 2002 14:08:58 +0200 (DST) From: Diego Olivier Fernandez Pons To: caml-list@inria.fr Subject: [Caml-list] Not allowed as right-hand side of 'let rec' Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Antivirus: scanned by sophie at shiva.jussieu.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bonjour, Je suis entrain de coder des Skip Lists (William Pugh 1990, 1994) qui est une structure de donn=E9es populaire outre-Atlantique et consiste en une liste circulaire cha=EEn=E9e dont tout =E9l=E9ment de hauteur h pointe = en outre vers son 2^k successeur avec k < h (le tout =E0 la sauce random am=E9ricaine) M'inspirant des listes circulaires cha=EEn=E9es (Cousineau et Mauny, Pottier) j'ai =E9crit : type 'a cell =3D { next : 'a cell array ; content : 'a } type 'a skipList =3D int * 'a cell Random.self_init ();; let max_height =3D 10;; let rec single =3D function x -> let h =3D Random.int max_height in let rec s =3D { next =3D Array.make h s ; next =3D x } in (1, s) Le compilateur r=E9pond : This kind of expression is not allowed as right-hand side of 'let rec', me for=E7ant =E0 me rabattre sur un type union type 'a cell =3D E | C of 'a cell array * 'a Pourquoi son comportement est-il diff=E9rent du cas des listes circulaires simplement cha=EEn=E9es ?=20 type 'a cell =3D { next : 'a cell ; content ; 'a } Diego Olivier note : si l'on pouvait avoir un affichage un peu plus r=E9duit pour les enregistrements qui pointent sur eux-m=EAmes ? ------------------- 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