OCaml's Extensive Libraries
Unless you relish reinventing the wheel every time you start a project, you need a
language that comes with standard libraries sufficient for modern programming. Like
most languages, OCaml distinguishes between libraries that come with the language and
which are supported by the language developers, and third-party libraries contributed by
The OCaml standard library
includes numbers of various sizes (including arbitrary-precision rationals),
strings, Booleans, arrays, tuples and of course lists; a portable I/O library and a
more sophisticated POSIX one; a large set of data structures including extensible
buffers, hash tables, association tables, queues, stacks, sets, streams ("infinite"
lists), disk-based hash tables (DBM); and libraries for command line argument
parsing, MD5 message digests, scanf-style input and printf-style output formatting,
filename manipulation, marshalling of data structures to disk, random number
generation, sorting, weak pointers (for implementing caches), threads, a very
complete library of POSIX and Unix system calls (including networking), regular
expressions, a simple portable graphics library and bindings for the Tk GUI.
The OCaml community has contributed hundreds of well-written libraries, many of
which can be browsed at the Caml Humps.
Some of the stuff available includes (sorry, haven't had time to link to all this):
- Web stuff, including several web servers (supporting various kinds of lightweight
OCaml applets, e.g. OCaml
HTTP), traditional CGI libraries, non-traditional CGI alternatives (e.g. WDialog), network string handling (e.g.,
MIME and URL encodings), the mod_caml
- Support for for other high-level networking protocols (e.g. Netchannels), like
FTP, SMTP, LDAP, Jabber, groupware toolkits (e.g. Ensemble),
network-transparent message passing, SOAP, XML-RPC, Sun RPC, etc.
- Cryptography, including algorithms like Blowfish, AES, DES, RSA Diffie-Helman, SHA-1,
MD5 and SSL.
- Data structures, including bit vectors, trees and graphs, heaps, multisets, search
trees (AVL, skew, red-black, tries, Patricia, splay, etc), etc.
- Database bindings, including Berkeley DB, Sybase, MySQL, Sqlite, ODBC, and PostgreSQL.
- Graphics and GUI's, including bindings for Xlib, OpenGL and GTK and interfaces to GD,
PostScript, GNUplot and the usual image formats.
- Interfaces to C++, Java, Perl, and Python (interfacing to C is of course built-in).
- GNU gettext binding for I18N.
- A large variety of OCaml make's, Makefile generators, autoconfs, packagers and IDE's.
- String manipulation, including Perl-Compatible Regular Expressions (PCRE) and lexer
generators, Unicode systems (e.g. Camomile).
- Templating systems, i.e. mixing OCaml source code into other types of text (e.g. HTML)
for dynamic text generation: CamlTemplate
- Compression and archiving, including gzip and bzip2 compression and Zip and Jar
- Threading and concurrency, including event queues.
- HTML and XHTML generation, macro processing, and validation.
- XML stuff, including parsers, generators, XQuery, XSLT, XML-RPC, RSS, XPATH, SOAP,