From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id OAA27707 for caml-redistribution; Thu, 1 Feb 1996 14:38:04 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id TAA14037 for ; Wed, 24 Jan 1996 19:47:09 +0100 Received: from margaux.inria.fr (margaux.inria.fr [128.93.8.2]) by concorde.inria.fr (8.7.1/8.7.1) with ESMTP id TAA24748 for ; Wed, 24 Jan 1996 19:47:08 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by margaux.inria.fr (8.6.10/8.6.6) with ESMTP id TAA03294 for ; Wed, 24 Jan 1996 19:47:08 +0100 Received: from polytechnique.polytechnique.fr (root@polytechnique.polytechnique.fr [129.104.30.1]) by concorde.inria.fr (8.7.1/8.7.1) with ESMTP id TAA24744 for ; Wed, 24 Jan 1996 19:47:07 +0100 (MET) Received: from poly.polytechnique.fr (Kh146UZDzGKqQD9Z8ZMMr5JwgRc8EB5I@poly.polytechnique.fr [129.104.252.1]) by polytechnique.polytechnique.fr (8.6.12/8.6.12) with ESMTP id TAA04232 for ; Wed, 24 Jan 1996 19:47:46 +0100 Received: (from canon@localhost) by poly.polytechnique.fr (8.6.10/8.6.6) id TAA02621 for caml-list@margaux.inria.fr; Wed, 24 Jan 1996 19:47:22 +0100 From: Hubert Canon Message-Id: <199601241847.TAA02621@poly.polytechnique.fr> Subject: Fonction polymorphe To: caml-list@margaux.inria.fr Date: Wed, 24 Jan 1996 19:47:22 +0100 (MET) X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: weis Un bug probable de caml-light : j'ai une fonction qui devrait etre polymorphe, mais elle change de type au premier appel : Avec caml light 7beta2 (le code n'est pas de moi) : #let permutations = let rec permut fixe = fun [] [] -> [fixe] | debut [] -> [] | debut (x :: suite) -> (permut (fixe @ [x]) [] (debut @ suite)) @ (permut fixe (debut @ [x]) suite) in permut [] [];; - : permutations : '_a list -> '_a list list = #permutations ["3";"456";""];; - : string list list = [["3"; "456"; ""]; ["3"; ""; "456"]; ["456"; "3"; ""]; ["456"; ""; "3"]; [""; "3"; "456"]; [""; "456"; "3"]] #permutations;; - : string list -> string list list = #permutations [1;2];; Entrée interactive: >permutations [1;2];; > ^^^^^^^^^^ Cette expression est de type int list, mais est utilisée avec le type string list. -- -------------------------- Hubert Canon -------------------------- Email : canon@poly.polytechnique.fr WWW : http://www.polytechnique.fr/poly/~canon/ ------------------------------------------------------------------