From: Pierre Weis <weis>
To: caml-redistribution
Subject: Re: bizarrerie du typage (fwd)
Date: Tue, 14 Jan 1997 08:53:30 +0100 (MET) [thread overview]
Message-ID: <199701140753.IAA04703@pauillac.inria.fr> (raw)
From: Didier Rousseau <Didier.Rousseau@cnam.fr>
Message-Id: <199701131435.PAA16829@fermi.cnam.fr>
X-Authentication-Warning: fermi.cnam.fr: localhost [127.0.0.1] didn't use HELO protocol
To: caml-list@inria.fr
Subject: Re: bizarrerie du typage
In-reply-to: Your message of "Sun, 12 Jan 97 20:19:43 +0100."
<Pine.GSO.3.95.970112201324.25242B-100000@brotteaux>
Date: Mon, 13 Jan 97 15:35:36 +0100
X-Mts: smtp
[Note du mode'rateur: Didier a envoye' 2 messages successifs, que j'ai
concate'ne's pour limiter le traffic]
Bonjour a tous
reponse au message de David.Monniaux@ens-lyon.fr
>...
>#let zero = fun x y -> y;;
>val zero : 'a -> 'b -> 'b = <fun>
>#let succ = fun n f x -> n f (f x);;
>val succ : (('a -> 'b) -> 'b -> 'c) -> ('a -> 'b) -> 'a -> 'c = <fun>
>#let un = succ zero;;
>val un : ('_a -> '_b) -> '_a -> '_b = <fun>
>#let deux = succ un;;
>val deux : ('_a -> '_a) -> '_a -> '_a = <fun>
>#deux (fun x -> x) 0;;
>- : int = 0
>#deux;;
>- : (int -> int) -> int -> int = <fun>
>
>Pourquoi le type de "deux" a-t-il change?
il y a une difference entre une variable de type 'a et '_a
l'une est generalisee, tandis que l'autre ne l'est pas encore...
et donc le sera des la premiere utilisation...
De facon generale :
soit une fun f : 'a -> 'b -> 'b
puis let f0 = f 0;;
ne sera pas accepte a la compil
le 'b ne pourra pas etre generalise
=> solution : let f0 x = f 0 x;;
=> il faut dans ce cas preciser tous les arguments
Donc en general, il y a un probleme entre variable de type et eta-reduction.
Mais je laisse la parole aux specialistes.
Didier Rousseau
*********************************************************
* " L'imagination est plus importante *
* que la connaissance. " *
* *
* A. E. *
*********************************************************
reply other threads:[~1997-01-14 7:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=199701140753.IAA04703@pauillac.inria.fr \
--to=caml-list@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