Prefix operators in ocaml

From: Eduardo Gimenez (Eduardo.Gimenez@inria.fr)
Date: Thu Jan 21 1999 - 15:42:20 MET


Date: Thu, 21 Jan 1999 15:42:20 +0100 (MET)
From: Eduardo Gimenez <Eduardo.Gimenez@inria.fr>
Message-Id: <199901211442.PAA19110@pauillac.inria.fr>
To: caml-list@inria.fr
Subject: Prefix operators in ocaml

Hello,

Which is the "prefix" name in Ocaml for the multiplication on
integers? The symbols (+), (/), etc. work fine for the other
arithmetic operations, but the symbol (*) does not.

Similarly, is there any prefix name for the list constructor (a::l) ?
I am thinking in something like (::) ....

Of course, I could define a function with the same behavior:
# let cons x y = x::y;;
val cons : 'a -> 'a list -> 'a list = <fun>

but this does not enable to write down expressions like
match x with cons (a,l) -> l.

PS: I am working in the context of automatic generation of ocaml code,
and being able to have a uniform treatment for datatype constructors
would simplify things a lot....

Thanks in advance,
Eduardo Gimenez.



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