<s>
OCaml	B-Language
(	O
,	O
formerly	O
Objective	B-Language
Caml	I-Language
)	O
is	O
a	O
general-purpose	B-Language
,	O
high-level	B-Language
multi-paradigm	O
programming	O
language	O
which	O
extends	O
the	O
Caml	B-Language
dialect	O
of	O
ML	B-Language
with	O
object-oriented	B-Language
features	O
.	O
</s>
<s>
OCaml	B-Language
was	O
created	O
in	O
1996	O
by	O
Xavier	O
Leroy	O
,	O
Jérôme	O
Vouillon	O
,	O
Damien	O
Doligez	O
,	O
Didier	O
Rémy	O
,	O
Ascánder	O
Suárez	O
,	O
and	O
others	O
.	O
</s>
<s>
The	O
OCaml	B-Language
toolchain	B-General_Concept
includes	O
an	O
interactive	O
top-level	O
interpreter	B-Application
,	O
a	O
bytecode	O
compiler	B-Language
,	O
an	O
optimizing	O
native	B-Language
code	I-Language
compiler	B-Language
,	O
a	O
reversible	O
debugger	B-Application
,	O
and	O
a	O
package	O
manager	O
(	O
OPAM	O
)	O
.	O
</s>
<s>
OCaml	B-Language
was	O
initially	O
developed	O
in	O
the	O
context	O
of	O
automated	B-Application
theorem	I-Application
proving	I-Application
,	O
and	O
has	O
an	O
outsize	O
presence	O
in	O
static	O
analysis	O
and	O
formal	B-Architecture
methods	I-Architecture
software	O
.	O
</s>
<s>
Beyond	O
these	O
areas	O
,	O
it	O
has	O
found	O
serious	O
use	O
in	O
systems	B-Application
programming	I-Application
,	O
web	O
development	O
,	O
and	O
financial	O
engineering	O
,	O
among	O
other	O
application	O
domains	O
.	O
</s>
<s>
The	O
acronym	O
CAML	B-Language
originally	O
stood	O
for	O
Categorical	B-Language
Abstract	I-Language
Machine	I-Language
Language	I-Language
,	O
but	O
OCaml	B-Language
omits	O
this	O
abstract	B-Application
machine	I-Application
.	O
</s>
<s>
OCaml	B-Language
is	O
a	O
free	B-License
and	I-License
open-source	I-License
software	I-License
project	O
managed	O
and	O
principally	O
maintained	O
by	O
the	O
French	O
Institute	O
for	O
Research	O
in	O
Computer	O
Science	O
and	O
Automation	O
(	O
Inria	O
)	O
.	O
</s>
<s>
In	O
the	O
early	O
2000s	O
,	O
elements	O
from	O
OCaml	B-Language
were	O
adopted	O
by	O
many	O
languages	O
,	O
notably	O
F#	B-Operating_System
and	O
Scala	B-Application
.	O
</s>
<s>
ML-derived	O
languages	O
are	O
best	O
known	O
for	O
their	O
static	O
type	O
systems	O
and	O
type-inferring	O
compilers	B-Language
.	O
</s>
<s>
OCaml	B-Language
unifies	O
functional	B-Language
,	O
imperative	B-Application
,	O
and	O
object-oriented	B-Language
programming	I-Language
under	O
an	O
ML-like	O
type	O
system	O
.	O
</s>
<s>
Thus	O
,	O
programmers	O
need	O
not	O
be	O
highly	O
familiar	O
with	O
the	O
pure	O
functional	B-Language
language	I-Language
paradigm	O
to	O
use	O
OCaml	B-Language
.	O
</s>
<s>
By	O
requiring	O
the	O
programmer	O
to	O
work	O
within	O
the	O
constraints	O
of	O
its	O
static	O
type	O
system	O
,	O
OCaml	B-Language
eliminates	O
many	O
of	O
the	O
type-related	O
runtime	B-Application
problems	O
associated	O
with	O
dynamically	O
typed	O
languages	O
.	O
</s>
<s>
Also	O
,	O
OCaml	B-Language
's	O
type-inferring	O
compiler	B-Language
greatly	O
reduces	O
the	O
need	O
for	O
the	O
manual	O
type	O
annotations	O
that	O
are	O
required	O
in	O
most	O
statically	O
typed	O
languages	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
data	O
types	O
of	O
variables	O
and	O
the	O
signatures	O
of	O
functions	O
usually	O
need	O
not	O
be	O
declared	O
explicitly	O
,	O
as	O
they	O
do	O
in	O
languages	O
like	O
Java	B-Language
and	O
C#	B-Application
,	O
because	O
they	O
can	O
be	O
inferred	O
from	O
the	O
operators	O
and	O
other	O
functions	O
that	O
are	O
applied	O
to	O
the	O
variables	O
and	O
other	O
values	O
in	O
the	O
code	O
.	O
</s>
<s>
Effective	O
use	O
of	O
OCaml	B-Language
's	O
type	O
system	O
can	O
require	O
some	O
sophistication	O
on	O
the	O
part	O
of	O
a	O
programmer	O
,	O
but	O
this	O
discipline	O
is	O
rewarded	O
with	O
reliable	O
,	O
high-performance	O
software	O
.	O
</s>
<s>
OCaml	B-Language
is	O
perhaps	O
most	O
distinguished	O
from	O
other	O
languages	O
with	O
origins	O
in	O
academia	O
by	O
its	O
emphasis	O
on	O
performance	O
.	O
</s>
<s>
Its	O
static	O
type	O
system	O
prevents	O
runtime	B-Application
type	O
mismatches	O
and	O
thus	O
obviates	O
runtime	B-Application
type	O
and	O
safety	O
checks	O
that	O
burden	O
the	O
performance	O
of	O
dynamically	O
typed	O
languages	O
,	O
while	O
still	O
guaranteeing	O
runtime	B-Application
safety	O
,	O
except	O
when	O
array	B-Data_Structure
bounds	I-Data_Structure
checking	I-Data_Structure
is	O
turned	O
off	O
or	O
when	O
some	O
type-unsafe	O
features	O
like	O
serialization	B-Application
are	O
used	O
.	O
</s>
<s>
Aside	O
from	O
type-checking	O
overhead	O
,	O
functional	B-Language
programming	I-Language
languages	I-Language
are	O
,	O
in	O
general	O
,	O
challenging	O
to	O
compile	B-Language
to	O
efficient	O
machine	B-Language
language	I-Language
code	O
,	O
due	O
to	O
issues	O
such	O
as	O
the	O
funarg	B-Application
problem	I-Application
.	O
</s>
<s>
Along	O
with	O
standard	O
loop	O
,	O
register	O
,	O
and	O
instruction	O
optimizations	B-Application
,	O
OCaml	B-Language
's	O
optimizing	B-Application
compiler	I-Application
employs	O
static	O
program	O
analysis	O
methods	O
to	O
optimize	O
value	O
boxing	O
and	O
closure	B-Language
allocation	O
,	O
helping	O
to	O
maximize	O
the	O
performance	O
of	O
the	O
resulting	O
code	O
even	O
if	O
it	O
makes	O
extensive	O
use	O
of	O
functional	B-Language
programming	I-Language
constructs	O
.	O
</s>
<s>
Xavier	O
Leroy	O
has	O
stated	O
that	O
"	O
OCaml	B-Language
delivers	O
at	O
least	O
50%	O
of	O
the	O
performance	O
of	O
a	O
decent	O
C	B-Language
compiler	B-Language
"	O
,	O
although	O
a	O
direct	O
comparison	O
is	O
impossible	O
.	O
</s>
<s>
Some	O
functions	O
in	O
the	O
OCaml	B-Language
standard	O
library	B-Library
are	O
implemented	O
with	O
faster	O
algorithms	O
than	O
equivalent	O
functions	O
in	O
the	O
standard	O
libraries	B-Library
of	O
other	O
languages	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
implementation	O
of	O
set	O
union	O
in	O
the	O
OCaml	B-Language
standard	O
library	B-Library
in	O
theory	O
is	O
asymptotically	O
faster	O
than	O
the	O
equivalent	O
function	O
in	O
the	O
standard	O
libraries	B-Library
of	O
imperative	B-Application
languages	I-Application
(	O
e.g.	O
,	O
C++	B-Language
,	O
Java	B-Language
)	O
because	O
the	O
OCaml	B-Language
implementation	O
exploits	O
the	O
immutability	O
of	O
sets	O
to	O
reuse	O
parts	O
of	O
input	O
sets	O
in	O
the	O
output	O
(	O
see	O
persistent	B-Application
data	I-Application
structure	I-Application
)	O
.	O
</s>
<s>
Milner	O
and	O
others	O
were	O
working	O
on	O
theorem	B-Application
provers	I-Application
,	O
which	O
were	O
historically	O
developed	O
in	O
languages	O
such	O
as	O
Lisp	B-Language
.	O
</s>
<s>
Milner	O
repeatedly	O
ran	O
into	O
the	O
issue	O
that	O
the	O
theorem	B-Application
provers	I-Application
would	O
attempt	O
to	O
claim	O
a	O
proof	O
was	O
valid	O
by	O
putting	O
non-proofs	O
together	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
he	O
went	O
on	O
to	O
develop	O
the	O
meta	B-Language
language	I-Language
for	O
his	O
Logic	O
for	O
Computable	O
Functions	O
,	O
a	O
language	O
that	O
would	O
only	O
allow	O
the	O
writer	O
to	O
construct	O
valid	O
proofs	O
with	O
its	O
polymorphic	O
type	O
system	O
.	O
</s>
<s>
ML	B-Language
was	O
turned	O
into	O
a	O
compiler	B-Language
in	O
order	O
to	O
simplify	O
using	O
LCF	O
on	O
different	O
machines	O
,	O
and	O
,	O
by	O
the	O
1980s	O
,	O
was	O
turned	O
into	O
a	O
complete	O
system	O
of	O
its	O
own	O
.	O
</s>
<s>
ML	B-Language
would	O
eventually	O
serve	O
as	O
a	O
basis	O
for	O
the	O
creation	O
of	O
OCaml	B-Language
.	O
</s>
<s>
In	O
the	O
early	O
1980s	O
,	O
there	O
were	O
some	O
developments	O
that	O
prompted	O
INRIA	O
's	O
Formel	O
team	O
to	O
become	O
interested	O
in	O
the	O
ML	B-Language
language	I-Language
.	O
</s>
<s>
Luca	O
Cardelli	O
,	O
a	O
research	O
professor	O
at	O
University	O
of	O
Oxford	O
,	O
used	O
his	O
Functional	B-Language
Abstract	B-Application
Machine	I-Application
to	O
develop	O
a	O
faster	O
implementation	O
of	O
ML	B-Language
,	O
and	O
Robin	O
Milner	O
proposed	O
a	O
new	O
definition	O
of	O
ML	B-Language
in	O
order	O
to	O
avoid	O
divergence	O
between	O
various	O
implementations	O
.	O
</s>
<s>
Simultaneously	O
,	O
Pierre-Louis	O
Curien	O
,	O
a	O
senior	O
researcher	O
at	O
Paris	O
Diderot	O
University	O
,	O
developed	O
a	O
calculus	O
of	O
categorical	O
combinators	O
and	O
linked	O
it	O
to	O
lambda	B-Language
calculus	I-Language
,	O
which	O
led	O
to	O
the	O
definition	O
of	O
the	O
Categorical	B-Application
Abstract	I-Application
Machine	I-Application
(	O
CAM	O
)	O
.	O
</s>
<s>
Guy	O
Cousineau	O
,	O
a	O
researcher	O
at	O
Paris	O
Diderot	O
University	O
,	O
recognized	O
that	O
this	O
could	O
be	O
applied	O
as	O
a	O
compilation	B-Language
technique	O
for	O
ML	B-Language
.	O
</s>
<s>
Caml	B-Language
was	O
initially	O
designed	O
and	O
developed	O
by	O
INRIA	O
's	O
Formel	O
team	O
headed	O
by	O
Gérard	O
Huet	O
.	O
</s>
<s>
The	O
first	O
implementation	O
of	O
Caml	B-Language
was	O
created	O
in	O
1987	O
and	O
was	O
further	O
developed	O
until	O
1992	O
.	O
</s>
<s>
Between	O
1990	O
and	O
1991	O
,	O
Xavier	O
Leroy	O
designed	O
a	O
new	O
implementation	O
of	O
Caml	B-Language
based	O
on	O
a	O
bytecode	O
interpreter	B-Application
written	O
in	O
C	B-Language
.	O
In	O
addition	O
to	O
this	O
,	O
Damien	O
Doligez	O
wrote	O
a	O
memory	O
management	O
system	O
,	O
also	O
known	O
as	O
a	O
sequential	O
garbage	B-General_Concept
collector	I-General_Concept
,	O
for	O
this	O
implementation	O
.	O
</s>
<s>
This	O
new	O
implementation	O
,	O
known	O
as	O
Caml	B-Language
Light	I-Language
,	O
replaced	O
the	O
old	O
Caml	B-Language
implementation	O
and	O
ran	O
on	O
small	O
desktop	O
machines	O
.	O
</s>
<s>
In	O
the	O
following	O
years	O
,	O
libraries	B-Library
such	O
as	O
Michel	O
Mauny	O
's	O
syntax	O
manipulation	O
tools	O
appeared	O
and	O
helped	O
promote	O
the	O
use	O
of	O
Caml	B-Language
in	O
educational	O
and	O
research	O
teams	O
.	O
</s>
<s>
In	O
1995	O
,	O
Xavier	O
Leroy	O
released	O
Caml	B-Language
Special	O
Light	O
,	O
which	O
was	O
an	O
improved	O
version	O
of	O
Caml	B-Language
.	O
</s>
<s>
An	O
optimizing	O
native-code	B-Language
compiler	B-Language
was	O
added	O
to	O
the	O
bytecode	O
compiler	B-Language
,	O
which	O
greatly	O
increased	O
performance	O
to	O
comparable	O
levels	O
with	O
mainstream	O
languages	O
such	O
as	O
C++	B-Language
.	O
</s>
<s>
Additionally	O
,	O
Leroy	O
designed	O
a	O
high-level	B-Language
module	B-Architecture
system	I-Architecture
inspired	O
by	O
the	O
module	B-Architecture
system	I-Architecture
of	O
Standard	B-Language
ML	I-Language
which	O
provided	O
powerful	O
facilities	O
for	O
abstraction	O
and	O
parameterization	O
and	O
made	O
larger-scale	O
programs	O
easier	O
to	O
construct	O
.	O
</s>
<s>
Didier	O
Rémy	O
and	O
Jérôme	O
Vouillon	O
designed	O
an	O
expressive	O
type	O
system	O
for	O
objects	O
and	O
classes	O
,	O
which	O
was	O
integrated	O
within	O
Caml	B-Language
Special	O
Light	O
.	O
</s>
<s>
This	O
led	O
to	O
the	O
emergence	O
of	O
the	O
Objective	B-Language
Caml	I-Language
language	O
,	O
first	O
released	O
in	O
1996	O
and	O
subsequently	O
renamed	O
to	O
OCaml	B-Language
in	O
2011	O
.	O
</s>
<s>
This	O
object	B-Language
system	I-Language
notably	O
supported	O
many	O
prevalent	O
object-oriented	B-Language
idioms	O
in	O
a	O
statically	O
type-safe	O
way	O
,	O
while	O
those	O
same	O
idioms	O
caused	O
unsoundness	O
or	O
required	O
runtime	B-Application
checks	O
in	O
languages	O
such	O
as	O
C++	B-Language
or	O
Java	B-Language
.	O
</s>
<s>
In	O
2000	O
,	O
Jacques	O
Garrigue	O
extended	O
Objective	B-Language
Caml	I-Language
with	O
multiple	O
new	O
features	O
such	O
as	O
polymorphic	O
methods	O
,	O
variants	O
,	O
and	O
labeled	O
and	O
optional	O
arguments	O
.	O
</s>
<s>
Language	O
improvements	O
have	O
been	O
incrementally	O
added	O
for	O
the	O
last	O
two	O
decades	O
in	O
order	O
to	O
support	O
the	O
growing	O
commercial	O
and	O
academic	O
codebases	O
in	O
OCaml	B-Language
.	O
</s>
<s>
The	O
OCaml	B-Language
4.0	O
release	O
in	O
2012	O
added	O
Generalized	O
Algebraic	O
Data	O
Types	O
(	O
GADTs	O
)	O
and	O
first-class	O
modules	B-Architecture
in	O
order	O
to	O
increase	O
the	O
flexibility	O
of	O
the	O
language	O
.	O
</s>
<s>
The	O
OCaml	B-Language
5.0.0	O
release	O
in	O
2022	O
is	O
a	O
complete	O
rewrite	O
of	O
the	O
language	O
runtime	B-Application
,	O
removing	O
the	O
global	B-Operating_System
GC	I-Operating_System
lock	I-Operating_System
and	O
adding	O
effect	O
handlers	O
via	O
delimited	O
continuations	O
.	O
</s>
<s>
These	O
changes	O
enable	O
support	O
for	O
shared-memory	O
parallelism	B-Operating_System
and	O
color-blind	O
concurrency	O
respectively	O
.	O
</s>
<s>
OCaml	B-Language
's	O
development	O
continued	O
within	O
the	O
Cristal	O
team	O
at	O
INRIA	O
until	O
2005	O
,	O
when	O
it	O
was	O
succeeded	O
by	O
the	O
Gallium	O
team	O
.	O
</s>
<s>
OCaml	B-Language
features	O
a	O
static	O
type	O
system	O
,	O
type	O
inference	O
,	O
parametric	O
polymorphism	O
,	O
tail	B-Language
recursion	I-Language
,	O
pattern	B-Language
matching	I-Language
,	O
first	O
class	O
lexical	B-Language
closures	I-Language
,	O
functors	O
(	O
parametric	O
modules	B-Architecture
)	O
,	O
exception	B-General_Concept
handling	I-General_Concept
,	O
effect	O
handling	O
,	O
and	O
incremental	O
generational	O
automatic	B-General_Concept
garbage	I-General_Concept
collection	I-General_Concept
.	O
</s>
<s>
OCaml	B-Language
is	O
notable	O
for	O
extending	O
ML-style	O
type	O
inference	O
to	O
an	O
object	B-Language
system	I-Language
in	O
a	O
general-purpose	B-Language
language	O
.	O
</s>
<s>
A	O
foreign	B-Application
function	I-Application
interface	I-Application
for	O
linking	B-Application
to	O
C	B-Language
primitives	O
is	O
provided	O
,	O
including	O
language	O
support	O
for	O
efficient	O
numerical	O
arrays	B-Data_Structure
in	O
formats	O
compatible	O
with	O
both	O
C	B-Language
and	O
Fortran	B-Application
.	O
</s>
<s>
OCaml	B-Language
also	O
supports	O
creating	O
libraries	B-Library
of	O
OCaml	B-Language
functions	O
that	O
can	O
be	O
linked	O
to	O
a	O
main	O
program	O
in	O
C	B-Language
,	O
so	O
that	O
an	O
OCaml	B-Language
library	B-Library
can	O
be	O
distributed	O
to	O
C	B-Language
programmers	O
who	O
have	O
no	O
knowledge	O
or	O
installation	O
of	O
OCaml	B-Language
.	O
</s>
<s>
The	O
OCaml	B-Language
distribution	O
contains	O
:	O
</s>
<s>
The	O
native	B-Language
code	I-Language
compiler	B-Language
is	O
available	O
for	O
many	O
platforms	O
,	O
including	O
Unix	B-Application
,	O
Microsoft	B-Application
Windows	I-Application
,	O
and	O
Apple	O
macOS	B-Application
.	O
</s>
<s>
Portability	O
is	O
achieved	O
through	O
native	B-Language
code	I-Language
generation	O
support	O
for	O
major	O
architectures	O
:	O
IA-32	B-Device
,	O
X86-64	B-Device
(	O
AMD64	B-Device
)	O
,	O
Power	B-Architecture
,	O
RISC-V	B-Device
,	O
ARM	B-Architecture
,	O
and	O
ARM64	B-Architecture
.	O
</s>
<s>
OCaml	B-Language
bytecode	O
and	O
native	B-Language
code	I-Language
programs	O
can	O
be	O
written	O
in	O
a	O
multithreaded	B-Operating_System
style	O
,	O
with	O
preemptive	O
context	O
switching	O
.	O
</s>
<s>
OCaml	B-Language
threads	B-Operating_System
in	O
the	O
same	O
domain	O
execute	O
by	O
time	O
sharing	O
only	O
.	O
</s>
<s>
However	O
,	O
an	O
OCaml	B-Language
program	O
can	O
contain	O
several	O
domains	O
.	O
</s>
<s>
There	O
are	O
several	O
libraries	B-Library
for	O
distributed	O
computing	O
such	O
as	O
and	O
.	O
</s>
<s>
Since	O
2011	O
,	O
many	O
new	O
tools	O
and	O
libraries	B-Library
have	O
been	O
contributed	O
to	O
the	O
OCaml	B-Language
development	O
environment	O
:	O
</s>
<s>
is	O
a	O
package	O
manager	O
for	O
OCaml	B-Language
.	O
</s>
<s>
provides	O
IDE-like	O
functionality	O
for	O
multiple	O
editors	O
,	O
including	O
type	O
throwback	O
,	O
go-to-definition	O
,	O
and	O
auto-completion	O
.	O
</s>
<s>
is	O
a	O
composable	O
build-system	O
for	O
OCaml	B-Language
.	O
</s>
<s>
is	O
an	O
auto-formatter	O
for	O
OCaml	B-Language
.	O
</s>
<s>
is	O
a	O
Language	O
Server	O
Protocol	O
for	O
OCaml	B-Language
IDE	B-Application
integration	O
.	O
</s>
<s>
is	O
an	O
instance	O
of	O
Discourse	B-Protocol
that	O
serves	O
as	O
the	O
primary	O
discussion	O
site	O
for	O
OCaml	B-Language
.	O
</s>
<s>
is	O
an	O
instance	O
of	O
PeerTube	B-Application
that	O
hosts	O
videos	O
about	O
OCaml	B-Language
topics	O
.	O
</s>
<s>
Alternate	O
compilers	B-Language
for	O
OCaml	B-Language
:	O
</s>
<s>
,	O
developed	O
by	O
the	O
Ocsigen	O
team	O
,	O
is	O
an	O
optimizing	B-Application
compiler	I-Application
from	O
OCaml	B-Language
to	O
JavaScript	B-Language
.	O
</s>
<s>
,	O
which	O
also	O
targets	O
JavaScript	B-Language
,	O
with	O
a	O
focus	O
on	O
producing	O
readable	O
,	O
idiomatic	O
JavaScript	B-Language
output	O
.	O
</s>
<s>
ocamlcc	O
is	O
a	O
compiler	B-Language
from	O
OCaml	B-Language
to	O
C	B-Language
,	O
to	O
complement	O
the	O
native	B-Language
code	I-Language
compiler	B-Language
for	O
unsupported	O
platforms	O
.	O
</s>
<s>
OCamlJava	O
,	O
developed	O
by	O
INRIA	O
,	O
is	O
a	O
compiler	B-Language
from	O
OCaml	B-Language
to	O
the	O
Java	B-Language
virtual	I-Language
machine	I-Language
(	O
JVM	B-Language
)	O
.	O
</s>
<s>
OCaPic	O
,	O
developed	O
by	O
Lip6	O
,	O
is	O
an	O
OCaml	B-Language
compiler	B-Language
for	O
PIC	B-Architecture
microcontrollers	I-Architecture
.	O
</s>
<s>
Snippets	O
of	O
OCaml	B-Language
code	O
are	O
most	O
easily	O
studied	O
by	O
entering	O
them	O
into	O
the	O
top-level	O
REPL	B-Application
.	O
</s>
<s>
This	O
is	O
an	O
interactive	O
OCaml	B-Language
session	O
that	O
prints	O
the	O
inferred	O
types	O
of	O
resulting	O
or	O
defined	O
expressions	O
.	O
</s>
<s>
The	O
OCaml	B-Language
top-level	O
is	O
started	O
by	O
simply	O
executing	O
the	O
OCaml	B-Language
program	O
:	O
</s>
<s>
OCaml	B-Language
infers	O
the	O
type	O
of	O
the	O
expression	O
to	O
be	O
"	O
int	O
"	O
(	O
a	O
machine-precision	O
integer	O
)	O
and	O
gives	O
the	O
result	O
"	O
7	O
"	O
.	O
</s>
<s>
The	O
following	O
program	O
"	O
hello.ml	O
 "	O
:	O
</s>
<s>
can	O
be	O
compiled	B-Language
into	O
a	O
bytecode	O
executable	O
:	O
</s>
<s>
or	O
compiled	B-Language
into	O
an	O
optimized	O
native-code	B-Language
executable	O
:	O
</s>
<s>
The	O
first	O
argument	O
to	O
ocamlc	O
,	O
"	O
hello.ml	O
 "	O
,	O
specifies	O
the	O
source	O
file	O
to	O
compile	B-Language
and	O
the	O
"	O
-o	O
hello	O
"	O
flag	O
specifies	O
the	O
output	O
file	O
.	O
</s>
<s>
The	O
option	O
type	O
constructor	O
in	O
OCaml	B-Language
,	O
similar	O
to	O
the	O
Maybe	O
type	O
in	O
Haskell	O
,	O
augments	O
a	O
given	O
data	O
type	O
to	O
either	O
return	O
Some	O
value	O
of	O
the	O
given	O
data	O
type	O
,	O
or	O
to	O
return	O
None	O
.	O
</s>
<s>
Lists	O
are	O
one	O
of	O
the	O
fundamental	O
datatypes	O
in	O
OCaml	B-Language
.	O
</s>
<s>
The	O
match	O
statement	O
has	O
similarities	O
to	O
C	B-Language
's	O
switch	O
element	O
,	O
though	O
it	O
is	O
far	O
more	O
general	O
.	O
</s>
<s>
Another	O
way	O
is	O
to	O
use	O
standard	O
fold	B-Application
function	I-Application
that	O
works	O
with	O
lists	O
.	O
</s>
<s>
Since	O
the	O
anonymous	B-General_Concept
function	I-General_Concept
is	O
simply	O
the	O
application	O
of	O
the	O
+	O
operator	O
,	O
this	O
can	O
be	O
shortened	O
to	O
:	O
</s>
<s>
Furthermore	O
,	O
one	O
can	O
omit	O
the	O
list	O
argument	O
by	O
making	O
use	O
of	O
a	O
partial	B-Application
application	I-Application
:	O
</s>
<s>
OCaml	B-Language
lends	O
itself	O
to	O
concisely	O
expressing	O
recursive	O
algorithms	O
.	O
</s>
<s>
The	O
following	O
code	O
example	O
implements	O
an	O
algorithm	O
similar	O
to	O
quicksort	B-Algorithm
that	O
sorts	O
a	O
list	O
in	O
increasing	O
order	O
.	O
</s>
<s>
Or	O
using	O
partial	B-Application
application	I-Application
of	O
the	O
>=	O
operator	O
.	O
</s>
<s>
The	O
following	O
code	O
defines	O
a	O
Church	B-Application
encoding	I-Application
of	O
natural	O
numbers	O
,	O
with	O
successor	O
(	O
succ	O
)	O
and	O
addition	O
(	O
add	O
)	O
.	O
</s>
<s>
A	O
Church	B-Application
numeral	I-Application
is	O
a	O
higher-order	B-Language
function	I-Language
that	O
accepts	O
a	O
function	O
and	O
a	O
value	O
and	O
applies	O
to	O
exactly	O
times	O
.	O
</s>
<s>
To	O
convert	O
a	O
Church	B-Application
numeral	I-Application
from	O
a	O
functional	B-Language
value	O
to	O
a	O
string	O
,	O
we	O
pass	O
it	O
a	O
function	O
that	O
prepends	O
the	O
string	O
to	O
its	O
input	O
and	O
the	O
constant	O
string	O
.	O
</s>
<s>
A	O
variety	O
of	O
libraries	B-Library
are	O
directly	O
accessible	O
from	O
OCaml	B-Language
.	O
</s>
<s>
For	O
example	O
,	O
OCaml	B-Language
has	O
a	O
built-in	O
library	B-Library
for	O
arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
.	O
</s>
<s>
Thus	O
,	O
factorial	O
is	O
a	O
suitable	O
candidate	O
for	O
arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
.	O
</s>
<s>
In	O
OCaml	B-Language
,	O
the	O
Num	O
module	B-Architecture
(	O
now	O
superseded	O
by	O
the	O
ZArith	O
module	B-Architecture
)	O
provides	O
arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
and	O
can	O
be	O
loaded	O
into	O
a	O
running	O
top-level	O
using	O
:	O
</s>
<s>
The	O
factorial	O
function	O
may	O
then	O
be	O
written	O
using	O
the	O
arbitrary-precision	B-Algorithm
numeric	O
operators	O
,	O
and	O
:	O
</s>
<s>
The	O
following	O
program	O
renders	O
a	O
rotating	O
triangle	O
in	O
2D	O
using	O
OpenGL	B-Application
:	O
</s>
<s>
The	O
LablGL	O
bindings	O
to	O
OpenGL	B-Application
are	O
required	O
.	O
</s>
<s>
The	O
program	O
may	O
then	O
be	O
compiled	B-Language
to	O
bytecode	O
with	O
:	O
</s>
<s>
Far	O
more	O
sophisticated	O
,	O
high-performance	O
2D	O
and	O
3D	O
graphical	O
programs	O
can	O
be	O
developed	O
in	O
OCaml	B-Language
.	O
</s>
<s>
Thanks	O
to	O
the	O
use	O
of	O
OpenGL	B-Application
and	O
OCaml	B-Language
,	O
the	O
resulting	O
programs	O
can	O
be	O
cross-platform	B-Operating_System
,	O
compiling	B-Language
without	O
any	O
changes	O
on	O
many	O
major	O
platforms	O
.	O
</s>
<s>
The	O
following	O
code	O
calculates	O
the	O
Fibonacci	B-Algorithm
sequence	I-Algorithm
of	O
a	O
number	O
n	O
inputted	O
.	O
</s>
<s>
It	O
uses	O
tail	B-Language
recursion	I-Language
and	O
pattern	B-Language
matching	I-Language
.	O
</s>
<s>
MetaOCaml	O
is	O
a	O
multi-stage	B-Application
programming	I-Application
extension	O
of	O
OCaml	B-Language
enabling	O
incremental	O
compiling	B-Language
of	O
new	O
machine	B-Language
code	I-Language
during	O
runtime	B-Application
.	O
</s>
<s>
Under	O
some	O
circumstances	O
,	O
significant	O
speedups	O
are	O
possible	O
using	O
multistage	O
programming	O
,	O
because	O
more	O
detailed	O
information	O
about	O
the	O
data	O
to	O
process	O
is	O
available	O
at	O
runtime	B-Application
than	O
at	O
the	O
regular	O
compile	B-Language
time	O
,	O
so	O
the	O
incremental	O
compiler	B-Language
can	O
optimize	O
away	O
many	O
cases	O
of	O
condition	O
checking	O
,	O
etc	O
.	O
</s>
<s>
As	O
an	O
example	O
:	O
if	O
at	O
compile	B-Language
time	O
it	O
is	O
known	O
that	O
some	O
power	B-Architecture
function	O
is	O
needed	O
often	O
,	O
but	O
the	O
value	O
of	O
is	O
known	O
only	O
at	O
runtime	B-Application
,	O
a	O
two-stage	O
power	B-Architecture
function	O
can	O
be	O
used	O
in	O
MetaOCaml	O
:	O
</s>
<s>
As	O
soon	O
as	O
is	O
known	O
at	O
runtime	B-Application
,	O
a	O
specialized	O
and	O
very	O
fast	O
power	B-Architecture
function	O
can	O
be	O
created	O
:	O
</s>
<s>
The	O
new	O
function	O
is	O
automatically	O
compiled	B-Language
.	O
</s>
<s>
(	O
2006	O
)	O
is	O
a	O
subset	O
of	O
OCaml	B-Language
3.08	O
that	O
uses	O
a	O
design	O
rule	O
verifier	O
to	O
enforce	O
object-capability	O
model	O
security	O
principles	O
.	O
</s>
<s>
F#	B-Operating_System
is	O
a	O
.NET	B-Application
Framework	I-Application
language	O
based	O
on	O
OCaml	B-Language
.	O
</s>
<s>
Fresh	O
OCaml	B-Language
facilitates	O
manipulating	O
names	O
and	O
binders	O
.	O
</s>
<s>
GCaml	O
adds	O
extensional	O
polymorphism	O
to	O
OCaml	B-Language
,	O
thus	O
allowing	O
overloading	O
and	O
type-safe	O
marshalling	O
.	O
</s>
<s>
JoCaml	B-Language
integrates	O
constructions	O
for	O
developing	O
concurrent	B-Operating_System
and	O
distributed	O
programs	O
.	O
</s>
<s>
OCamlDuce	O
extends	O
OCaml	B-Language
with	O
features	O
such	O
as	O
XML	O
expressions	O
and	O
regular-expression	O
types	O
.	O
</s>
<s>
OCamlP3l	O
is	O
a	O
parallel	B-Operating_System
programming	I-Operating_System
system	O
based	O
on	O
OCaml	B-Language
and	O
the	O
P3L	O
language	O
.	O
</s>
<s>
Reason	B-Application
is	O
an	O
alternative	O
OCaml	B-Language
syntax	O
and	O
toolchain	B-General_Concept
for	O
OCaml	B-Language
created	O
at	O
Facebook	B-Application
,	O
which	O
can	O
compile	B-Language
to	O
both	O
native	B-Language
code	I-Language
and	O
JavaScript	B-Language
.	O
</s>
<s>
ReScript	O
is	O
a	O
rebranding	O
and	O
new	O
language	O
from	O
the	O
Reason/BuckleScript	O
toolchain	B-General_Concept
,	O
which	O
has	O
different	O
syntax	O
and	O
only	O
compiles	B-Language
to	O
JavaScript	B-Language
.	O
</s>
<s>
0install	B-Application
,	O
a	O
multi-platform	B-Operating_System
package	O
manager	O
.	O
</s>
<s>
Coccinelle	O
,	O
a	O
utility	O
for	O
transforming	B-Application
the	O
source	O
code	O
of	O
C	B-Language
programs	I-Language
.	O
</s>
<s>
Coq	B-Application
,	O
a	O
formal	O
proof	O
management	O
system	O
.	O
</s>
<s>
FFTW	B-Application
,	O
a	O
library	B-Library
for	O
computing	O
discrete	B-Algorithm
Fourier	I-Algorithm
transforms	I-Algorithm
.	O
</s>
<s>
Several	O
C	B-Language
routines	O
have	O
been	O
generated	O
by	O
an	O
OCaml	B-Language
program	O
named	O
.	O
</s>
<s>
The	O
web	O
version	O
of	O
Facebook	B-Protocol
Messenger	I-Protocol
.	O
</s>
<s>
Flow	O
,	O
a	O
static	O
analyzer	O
created	O
at	O
Facebook	B-Application
that	O
infers	O
and	O
checks	O
static	O
types	O
for	O
JavaScript	B-Language
.	O
</s>
<s>
Owl	B-Application
Scientific	I-Application
Computing	I-Application
,	O
a	O
dedicated	O
system	O
for	O
scientific	O
and	O
engineering	O
computing	O
.	O
</s>
<s>
Frama-C	B-Language
,	O
a	O
framework	O
for	O
analyzing	O
C	B-Language
programs	I-Language
.	O
</s>
<s>
GeneWeb	B-Language
,	O
free	B-License
and	I-License
open-source	I-License
multi-platform	B-Operating_System
genealogy	O
software	O
.	O
</s>
<s>
The	O
Hack	B-Language
programming	B-Language
language	I-Language
compiler	I-Language
,	O
created	O
at	O
Facebook	B-Application
,	O
extending	O
PHP	B-Application
with	O
static	O
types	O
.	O
</s>
<s>
The	O
Haxe	B-Language
programming	B-Language
language	I-Language
compiler	I-Language
.	O
</s>
<s>
HOL	B-Application
Light	I-Application
,	O
a	O
formal	O
proof	O
assistant	O
.	O
</s>
<s>
Infer	O
,	O
a	O
static	O
analyzer	O
created	O
at	O
Facebook	B-Application
for	O
Java	B-Language
,	O
C	B-Language
,	O
C++	B-Language
,	O
and	O
Objective-C	B-Language
,	O
used	O
to	O
detect	O
bugs	O
in	O
iOS	B-Application
and	O
Android	B-Application
apps	O
.	O
</s>
<s>
MirageOS	B-Operating_System
,	O
a	O
unikernel	B-Operating_System
programming	O
framework	O
written	O
in	O
pure	O
OCaml	B-Language
.	O
</s>
<s>
MLdonkey	B-Protocol
,	O
a	O
peer-to-peer	O
file	O
sharing	O
application	O
based	O
on	O
the	O
EDonkey	O
network	O
.	O
</s>
<s>
Ocsigen	O
,	O
an	O
OCaml	B-Language
web	B-Application
framework	I-Application
.	O
</s>
<s>
Opa	B-Language
,	O
a	O
free	B-License
and	I-License
open-source	I-License
programming	O
language	O
for	O
web	O
development	O
.	O
</s>
<s>
pyre-check	O
,	O
a	O
type	O
checker	O
for	O
Python	B-Language
created	O
at	O
Facebook	B-Application
.	I-Application
</s>
<s>
Tezos	B-Protocol
,	O
a	O
self-amending	O
smart	O
contract	O
platform	O
using	O
XTZ	O
as	O
a	O
native	O
currency	O
.	O
</s>
<s>
,	O
a	O
file	B-Application
synchronization	I-Application
program	O
to	O
synchronize	O
files	O
between	O
two	O
directories	O
.	O
</s>
<s>
The	O
reference	O
interpreter	B-Application
for	O
WebAssembly	B-Language
,	O
a	O
low-level	O
bytecode	O
intended	O
for	O
execution	O
inside	O
web	B-Application
browsers	I-Application
.	O
</s>
<s>
Xen	B-Operating_System
Cloud	I-Operating_System
Platform	I-Operating_System
(	O
XCP	O
)	O
,	O
a	O
turnkey	O
virtualization	B-General_Concept
solution	O
for	O
the	O
Xen	B-Operating_System
hypervisor	I-Operating_System
.	O
</s>
<s>
Several	O
dozen	O
companies	O
use	O
OCaml	B-Language
to	O
some	O
degree	O
.	O
</s>
<s>
Bloomberg	O
L.P.	O
,	O
which	O
created	O
,	O
an	O
OCaml	B-Language
compiler	B-Language
backend	O
targeting	O
JavaScript	B-Language
.	O
</s>
<s>
Citrix	B-Application
Systems	I-Application
,	O
which	O
uses	O
OCaml	B-Language
in	O
XenServer	B-Operating_System
(	O
rebranded	O
as	O
Citrix	B-Application
Hypervisor	B-Operating_System
during	O
2018	O
)	O
.	O
</s>
<s>
Facebook	B-Application
,	O
which	O
developed	O
Flow	O
,	O
Hack	B-Language
,	O
Infer	O
,	O
Pfff	O
,	O
and	O
Reason	B-Application
in	O
OCaml	B-Language
.	O
</s>
<s>
Jane	O
Street	O
Capital	O
,	O
a	O
proprietary	O
trading	O
firm	O
,	O
which	O
adopted	O
OCaml	B-Language
as	O
its	O
preferred	O
language	O
in	O
its	O
early	O
days	O
.	O
</s>
