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 OAA27329; Thu, 8 Aug 2002 14:58:27 +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 OAA27216 for ; Thu, 8 Aug 2002 14:58:26 +0200 (MET DST) Received: from postfix2-1.free.fr (postfix2-1.free.fr [213.228.0.9]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g78CwPn20521 for ; Thu, 8 Aug 2002 14:58:25 +0200 (MET DST) Received: from montchapet.dijon.fr (dijon-1-a7-62-147-68-21.dial.proxad.net [62.147.68.21]) by postfix2-1.free.fr (Postfix) with ESMTP id 8ED74784 for ; Thu, 8 Aug 2002 14:57:43 +0200 (CEST) Received: from montchapet (localhost [127.0.0.1]) by montchapet.dijon.fr (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) with SMTP id g78CuUF03497 for ; Thu, 8 Aug 2002 14:56:30 +0200 Date: Thu, 8 Aug 2002 14:56:30 +0200 From: Michel Quercia To: caml-list@inria.fr Subject: Re: [Caml-list] Not allowed as right-hand side of 'let rec' Message-Id: <20020808145630.715bf4c1.michel.quercia@prepas.org> In-Reply-To: References: X-Mailer: Sylpheed version 0.7.2 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Le Thu, 8 Aug 2002 14:08:58 +0200 (DST) Diego Olivier Fernandez Pons écrivit : > Je suis entrain de coder des Skip Lists ... > ... > let rec single = function x -> > let h = Random.int max_height in > let rec s = { next = Array.make h s ; next = x } > in (1, s) > > Le compilateur répond : This kind of expression is not allowed as > right-hand side of 'let rec' Car s est défini en fonction de lui-même par un appel de fonction : s = f(s) et le compilateur ne sait pas calculer automatiquement un point fixe de f. Ceci devrait marcher : let single = function x -> let h = Random.int max_height in let dummy = {next = [||]; content = x} in let s = { next = Array.make h dummy ; content = x } in Array.fill s.next 0 h s; (1, s) > note : si l'on pouvait avoir un affichage un peu plus réduit pour les > enregistrements qui pointent sur eux-mêmes ? Vous pouvez écrire une fonction d'impression ad-hoc et signaler au toplevel de l'utiliser via la directive install_printer. Cordialement, -- Michel Quercia 23 rue de Montchapet, 21000 Dijon http://michel.quercia.free.fr (maths) http://pauillac.inria.fr/~quercia (informatique) mailto:michel.quercia@prepas.org ------------------- 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