OCaml By Examples

utop

console

**utop** is OCaml's [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) (referred to as a *toplevel* in OCaml): an interactive program that allows you to quickly test OCaml commands.
$ opam install utop
$ utop

utop

In utop, you can experiment with code, load libraries and debug modules. Note that nothing gets executed unless you write `;;` to indicate that things should get executed.
utop # 1 + 1;;
- : int = 2

utop # 1 = 1;;
- : bool = true

.ocamlinit

Libraries are by default not accessible in utop, unless you write `#require "library_name";;`.<br> As Core is a standard library replacement you can enter these few lines in your `~/.ocamlinit` file to initialize utop with Core automatically.
#use "topfind";;
#thread;;
#require "core.top";;
open Core;;
next: values