arity of type constructors

From: Christian Lindig (lindig@ips.cs.tu-bs.de)
Date: Wed May 07 1997 - 15:16:06 MET DST


Date: Wed, 7 May 1997 15:16:06 +0200 (MET DST)
Message-Id: <199705071316.PAA14881@infbsst5.ips.cs.tu-bs.de>
From: Christian Lindig <lindig@ips.cs.tu-bs.de>
To: caml-list@inria.fr
Subject: arity of type constructors

Dear Caml-Enthusiasts,

the following example of applying arguments to a new type constructor
was surprising for me. I'm wondering if it's a bug or a feature:

        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?

Christian

[sorry, no french version - will visit Paris in summer as a compensation :-)]
------------------------------------------------------------------------------
 Christian Lindig lindig@ips.cs.tu-bs.de
 TU Braunschweig fon +49 531 391 7465
 Institut fuer Programmiersprachen fax +49 531 391 8140
 D-38106 Braunschweig http://www.cs.tu-bs.de



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