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 OAA26508; Thu, 31 Jan 2002 14:40:03 +0100 (MET) 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 OAA26433 for ; Thu, 31 Jan 2002 14:40:02 +0100 (MET) Received: from fep43-svc.tin.it (mta43-acc.tin.it [212.216.176.239]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g0VDe1D07471 for ; Thu, 31 Jan 2002 14:40:01 +0100 (MET) Received: from there ([212.171.41.89]) by fep43-svc.tin.it (InterMail vM.4.01.03.13 201-229-121-113) with SMTP id <20020131133959.IQWC4346.fep43-svc.tin.it@there> for ; Thu, 31 Jan 2002 14:39:59 +0100 Content-Type: text/plain; charset="iso-8859-1" From: stalkern2 To: caml-list@inria.fr Subject: Re: [Caml-list] [Beginner in CAML] Pas avec les listes Date: Thu, 31 Jan 2002 14:45:23 -0500 X-Mailer: KMail [version 1.3.1] References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <20020131133959.IQWC4346.fep43-svc.tin.it@there> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Ça ne change rien par rapport au type enregistrement ou au tipe couple. Le type "list" n'existe pas, soit, c'est un super-type, c'est toujours une "list de quelque chose", et ses données sont homogènes. Alors ce qu'il faut ce n'est pas de définir le type "rationnel" à partir d'un type "liste", mais définir au plus un type "liste de rationnels" à partir du type "liste de quelque chose". Ceci parce que les listes servent a gérer des séquences, c'est-à-dire à ^etre tranchées, non pas à servir de modèle. Dans le cas des rationnels, un tipe {(int1:int) ; (int2:int) } ou un couple (int * int) est utilisé d'habitude. Dans le cas du type enregistrement, tu en tires un vrai rationnel disant par ex. type rat = {int1:int;int2:int};; let vrai_rat = {int1=3;int2=4};; et tu en récupéres le contenu appelant vrai_rat.int1 et vrai_rat.int2 Dans le cas du couple, tu peux utiliser le type casting type rat = int * int;; let (vrai_rat:rat) = (3,4);; pour obtenir un vrai rationnel e tu as fst(int * int) et snd(int * int) ou bien des pattern matchings pour récupérer le contenu. Ciao Ernesto PS Je suis un beginner aussi, j'espère avoir bien dit. Alle ore 06:27, giovedì 31 gennaio 2002, COLLINEAU Franck FTRD/DMI/TAM ha scritto: > Greetings, > > I would like to create the rational type from the list type. > > How can i do ? > > Regards, > > Franck ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr