OCaml (also knows as Objective Caml) — is a modern object-oriented functional programming language of general purpose. Language has a high level of expressiveness, which allows to learn and use it easily. OCaml supports functional, imperative and object-oriented programming paradigms. Also, this is the most popular version of ML programming language.
The OCaml toolkit includes an interpreter, a compiler in bytecode, and an optimizing compiler into machine code that is comparable in efficiency to Java and only slightly inferior in speed to C and C ++.
Some facts about OCaml:
- The language was developed at the French Institute INRIA in 1985 and is in developing to this day.
- It is a multi-paradigmatic (functional, imperative, object-oriented) programming language for general purpose with automatic garbage collection.
- The language supports lambdas, closures, currying, tail recursion, pattern matching and immutable data.
- Pointers, loops, variable data and functions with side effects are also presented in OCaml.
- By default, the calculation is strict, but if necessary, you can use lazy calculations or simply pass functions as arguments.
- The program on OCaml can be interpreted, compiled into a virtual machine bytecode (called Zinc) or machine code.
- Even on OCaml, you can write under JVM, as well as under .NET, where the language for some reason is called F #.
- Indents in OCaml can be put as you like.
- In terms of performance, OCaml is comparable to Java, Haskell, and Go.
We've collected the information about the most helpful tutorials, interesting books and useful IDEs.
OCaml is not so widely used as Java or Ruby, so, there aren't so many tutorials and learning materials as for those languages. But there are still good materials for both beginners and skilled coders.
How to install OCaml on Mac?
First of all, you will have to install OCaml of your PC. This article will help you to install OCaml on Mac OS. Written by a skilled coder and has step-by-step instructions and screenshots.
This web tutorial allows you to immediately start learning OCaml in your browser, without installing it. Veru convenient approach.
Big OCaml's section at RosettaCode - a website, that collects task solutions for different programming languages.
Great knowledge portal; every coder can find a solution for his issue here. Every solution is a piece of a code, written on a certain language.
This simple website with minimalist design provides OCaml solutions to the complete set of "classic" programming.
OCaml is one of only 3 languages for which the full set of solutions has been provided. The approach is based on the popular "Perl Cookbook".
Best OCaml book
The books will never go out of fashion. Here is the list of most interesting OCaml books.
Real World OCaml
This book will show you how to solve day-to-day problems programming issues in data processing, numerical computation, system scripting, and database-driven web applications with the OCaml.
Real World OCaml
This hands-on book shows you how to take advantage of OCaml’s functional, imperative, and object-oriented programming styles with recipes for many real-world tasks.
You’ll start with OCaml basics, including how to set up a development environment, and move toward more advanced topics such as the module system, foreign-function interface, macro language, and the ocamlbuild system. Quickly learn how to put OCaml to work for writing succinct and readable code.
OCaml from the Very Beginning
In this book author takes a direct approach to teaching this programming language.
Real World OCaml
Each small, self-contained chapter introduces a new topic, building until the reader can write quite substantial programs. There are plenty of questions and worked answers and tips.
"OCaml from the Very Beginning" will appeal both to new and skilled programmers. It is suitable both for formal use within an undergraduate or graduate curriculum, and for the interested amateur.
Also, the newest version of OCaml documentation can be found at the official website.
When you will become familiar with OCaml and would like to use it for work or fun, it is time chose proper environment.
Platforms: Windows, Linux, Mac OS.
Price: freeware with ability for donation.
- Flexible code editing: most of the operations have hotkeys, cursor can be moved by symbols, worlds, lines, paragraphs, functions or massives;
- High level of customization. Almost all functions of the editor can be reconfigured for you. To do this, you must have at least basic knowledge in Elisp, but some changes can be made through a visual interface;
- ocaml-mode from the standard distribution;
- alternative tuareg-mode;
- camldebug intergration with debugger.
Platforms: Windows, Mac OS, Linux, iOS, Android.
Price: freeware. Work with OCaml requires a plugin.
- Vim is one of the most customizable text editors. It supports the saving of undo operations even after the program is closed, clipboard switching, automatic creation of the workpiece of the scripts;
- Works in the mode of insertion, console and visual. Simultaneous opening of several files, window management;
- Simple expansion of the editor with other languages due to the large database of plugins;
- Support syntax highlighting, automatic indentation, code checking with Syntastic;
- The plugin is recommended on the official page.
Platform: Linux, Windows.
- Specialized OCaml IDE;
- Customizable syntax highlighting;
- Automatic indentation;
- Commenting/uncommenting of code blocks;
- Automatic compilation of the currently open file;
- Code folding;
- Completion popup with types description and documentation;
- Structure Pane;
- Ability to display the types inferred by the compiler;
- Find definition/references;
- Switch between interface and implementation with automatic interface generation.
OCaml (also knows as Objective Caml) — is a modern object-oriented functional programming language of general purpose. Language has a high level of expressiveness, which allows to learn and use it easily. Do you use programming language OCaml in your work?