From: Hubert Canon <canon@poly.polytechnique.fr>
To: caml-list@margaux.inria.fr
Subject: Fonction polymorphe
Date: Wed, 24 Jan 1996 19:47:22 +0100 (MET) [thread overview]
Message-ID: <199601241847.TAA02621@poly.polytechnique.fr> (raw)
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 = <fun>
#permutations ["3";"456";""];;
- : string list list =
[["3"; "456"; ""]; ["3"; ""; "456"]; ["456"; "3"; ""]; ["456"; ""; "3"];
[""; "3"; "456"]; [""; "456"; "3"]]
#permutations;;
- : string list -> string list list = <fun>
#permutations [1;2];;
Entrée interactive:
>permutations [1;2];;<EOF>
> ^^^^^^^^^^
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/
------------------------------------------------------------------
next reply other threads:[~1996-02-01 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-01-24 18:47 Hubert Canon [this message]
1996-02-01 14:03 ` Pierre Weis
1996-02-01 14:03 ` Eric Hassold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199601241847.TAA02621@poly.polytechnique.fr \
--to=canon@poly.polytechnique.fr \
--cc=caml-list@margaux.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox