Browse thread
- Jun P. Furuse
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jun P. Furuse <Jun.Furuse@i...> |
| Subject: |
> 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.
You need a small trick. Try ( * ) or ( *).
> Similarly, is there any prefix name for the list constructor (a::l) ?
> I am thinking in something like (::) ....
:: is not an infix operator, but an infix constructor. It is handled
specially by the parser. Like the other normal constructors, you
always need its arguments i.e.:
# type 'a option =
None
| Some of 'a
# Some;;
The constructor Some expects 1 argument(s),
but is here applied to 0 argument(s)
# fun x -> Some x;;
- : 'a -> 'a option = <fun>
The constructor names themselves are not functions in O'Caml.
-----------------------------------------------------------------------
Jun P. Furuse Jun.Furuse@inria.fr
INRIA
Institut National de Recherche en Informatique et en Automatique