···2323\end{alltt}
2424This defines the value name \var{name} as a function with type
2525\var{type} that executes by calling the given C function.
2626-For instance, here is how the "int_of_string" primitive is declared in the
2626+For instance, here is how the "seek_in" primitive is declared in the
2727standard library module "Stdlib":
2828\begin{verbatim}
2929- external int_of_string : string -> int = "caml_int_of_string"
2929+ external seek_in : in_channel -> int -> unit = "caml_ml_seek_in"
3030\end{verbatim}
3131Primitives with several arguments are always curried. The C function
3232does not necessarily have the same name as the ML function.
···5151The arity (number of arguments) of a primitive is automatically
5252determined from its OCaml type in the "external" declaration, by
5353counting the number of function arrows in the type. For instance,
5454-"input" above has arity 4, and the "input" C function is called with
5555-four arguments. Similarly,
5454+"seek_in" above has arity 2, and the "caml_ml_seek_in" C function
5555+is called with two arguments. Similarly,
5656\begin{verbatim}
5757- external input2 : in_channel * bytes * int * int -> int = "input2"
5757+ external seek_in_pair: in_channel * int -> unit = "caml_ml_seek_in_pair"
5858\end{verbatim}
5959-has arity 1, and the "input2" C function receives one argument (which
6060-is a quadruple of OCaml values).
5959+has arity 1, and the "caml_ml_seek_in_pair" C function receives one argument
6060+(which is a pair of OCaml values).
61616262Type abbreviations are not expanded when determining the arity of a
6363primitive. For instance,