**Next message:**Hubert Canon: "Re: arity of type constructors"**Previous message:**David Monniaux: "Re: arity of type constructors"**Maybe in reply to:**Christian Lindig: "arity of type constructors"**Next in thread:**Hubert Canon: "Re: arity of type constructors"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ]

Date: Fri, 09 May 1997 07:57:00 +0200

From: Michel Quercia <quercia@cal.enst.fr>

To: Christian Lindig <lindig@ips.cs.tu-bs.de>

Subject: Re: arity of type constructors

Christian Lindig wrote:

*>
*

*> Objective Caml version 1.05
*

*> # type t = T of int * int;;
*

*> type t = | T of int * int
*

*> # let x = (3,4);;
*

*> val x : int * int = 3, 4
*

*> # T x;;
*

*> The constructor T expects 2 argument(s), but is here applied
*

*> to 1 argument(s)
*

*> # T (3,4);;
*

*> - : t = T (3, 4)
*

*>
*

*> Applying T to x does not work, but applying it to (3,4) does. Why is
*

*> the pair (3,4) counted as 2 arguments?
*

*>
*

here is the trick :

Objective Caml version 1.05

# type t = T of int * int;;

type t = | T of int * int

# T(3,4);;

- : t = T (3, 4)

# let x = (3,4) in T(x);;

The constructor T expects 2 argument(s), but is here applied to 1

argument(s)

# type u = U of (int * int);;

type u = | U of (int * int)

# let x = (3,4) in U(x);;

- : u = U (3, 4)

#

-- Michel Quercia Lycee Carnot 16 bd Thiers 21000 Dijon mailto:quercia@cal.enst.fr

**Next message:**Hubert Canon: "Re: arity of type constructors"**Previous message:**David Monniaux: "Re: arity of type constructors"**Maybe in reply to:**Christian Lindig: "arity of type constructors"**Next in thread:**Hubert Canon: "Re: arity of type constructors"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ]

*
This archive was generated by hypermail 2b29
: Sun Jan 02 2000 - 11:58:10 MET
*