CSE 130 SP16- How to run OCaml



We will be using a special version of the super nifty ocaml-top IDE to interact with Ocaml.

This version has been instrumented to gather interaction traces to help understand how students learn ocaml, therefore helping future generations of students!

In Lab (ieng)

The IDE is slightly tricky to build, and so we have already installed it on the lab machines. Simply type:

$ prep cs130f
.
.
.
$ ocaml-top

at the Unix shell prompt to fire up the IDE.

At Home

You can run the IDE at home by logging into ieng and then using one of

Usage

The IDE is pretty intuitive. See the web page for details.

Debugging

If you want to see the value of some expression e then just write:

let _ = e 

into the editor pane, put your cursor after the e and hit play.

Also, remember that you can print stuff in Ocaml by:

let name = "Ranjit"
let age  = 36
let _    = Format.printf "My name is %s and I am %d years old" name age 

Produces the output

val name : string = "Ranjit"
val age : int = 36

My name is Ranjit and I am 36 years old
- : unit = ()