Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Before teaching OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-01-07 (22:37)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Before teaching OCaml
On Sun, 2007-01-07 at 19:15 +0100, David Teller wrote:
>   Dear list,
>  I'm going to start teaching OCaml soon and I'm fishing for ideas and
> suggestions. I hope this list is the right place to ask.

> Right now, I see the following difficulties:
> * the environment -- under Windows, is there any viable alternative to
> Emacs + the MinGW-based port ? 

Emacs? Gak! You want them to waste the whole semester
learning an editor? Notepad is perfectly acceptable.
There's probably a version of gedit that runs on Windows.

The Windows native port is fine, but you do need the 
MS assembler and compiler executables (and ml.err, the
assembler error file). 

> * the Makefile

Why not just show them how to write out a script by giving them 
a simple example to edit, something like:

ocamlc -c file1.mli
ocamlc -c file2.mli
ocamlopt -c
ocamlopt -c
ocamlopt file1.cmx file2.cmx -o program

and explain the ordering requirements. 

There are several auto-makers for Ocaml (as mentioned in other
emails) .. but using these hides understanding of how the
ocaml tools work.

> * the task -- for the moment, I have no interesting idea of OCaml-based
> projects. Perhaps something like finding the shortest path along
> subway/train lines ?

I would tend to provide a simple but not trivial problem,
and get them to write it in a familiar procedural style .. then
show how to convert it to a functional style, and what the
advantages are. So you'd want to pick a problem which is 
amenable to both kinds of solution.

EG .. convert loops to tail recursions, convert inner 
recursions to tail recursions, replace variables
with arguments, continuation passing, HOFs, etc.

One possible project is a small interpreter .. it has 
plenty of scope for variations, and has the advantage
of being interactive without requiring graphics.

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: