Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Prefix operators in ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-01-21 (15:34)
From: Eduardo Gimenez <Eduardo.Gimenez@i...>
Subject: Prefix operators in ocaml


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.