Ken Wakita (https://wakita.github.io/fp2017/)
Sep. 25, 2017
Bookmark:
Introduction to OCaml
The organization of the MinCaml compiler
Learn the basic syntax (comments, function calls, function definition), basic types, type casting, and functional types.
Linux: use the package manager of your Linux distribution
Mac: brew install ocaml
Windows: a binary distribution is available from the official site
Start OCaml interpreter: open terminal on Linux /Mac or start cmd.exe
on Windows
Run ocaml
. If your installation is fine OCaml welcomes you with its version number and a prompt #
:
OCaml version 4.05.0
#
Try out some examples from OCaml: The Basics
let repeated s n =
for i = 1 to n do
print_endline(s)
done;;
repeated "hello" 3;;
Please bring your laptop for the next class
Recommended reading: