caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alessandro Baretta <alex@baretta.com>
To: climb <onlyclimb@163.com>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] Re: how to start
Date: Thu, 17 Oct 2002 02:58:17 +0200	[thread overview]
Message-ID: <3DAE0B29.4090305@baretta.com> (raw)
In-Reply-To: <200210161407.g9GE7r505067@concorde.inria.fr>



climb wrote:
> Dear caml-list
>  
>  i am a new commer of Caml language.

Welcome on board!

> and start with online mannul
>  i am confused at this sentence in Chapter 1
> # type idref={ mutable id : 'a. 'a -> 'a};;
> what does "." mean?

'a. 'a -> 'a

This is read as: "For every type 'a, a function from 'a to
'a". In this context 'a is a type variable. The type
variable preceding the "." are "universally quantified":
this is where the "For every type ..." comes into the game.

This basically states that the type of id is polymorphic: 'a
-> 'a  is a type schema as opposed to a specific type. Many
different types fit this schema:
int -> int
string -> string
(int -> int) -> (int -> int), and so on.

The type schema 'a. 'a -> 'a is entirely equivalent to the
axiom schema of propositional calculus A => A: "If A then
A." A stands for *any* proposition, not for any one specific
proposition.


> why i can not write 
> # type intidref= { mutable id : int. int->int};;

This does not make sense because "int" is a type value and
not a type variable.


Alex

-------------------
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


  reply	other threads:[~2002-10-17  0:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-16 14:07 climb
2002-10-17  0:58 ` Alessandro Baretta [this message]
2002-10-17 17:00 climb
2002-10-18  7:28 ` [Caml-list] Re: how to start Florian Hars

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=3DAE0B29.4090305@baretta.com \
    --to=alex@baretta.com \
    --cc=caml-list@inria.fr \
    --cc=onlyclimb@163.com \
    /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;
as well as URLs for NNTP newsgroup(s).