Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Dan Hipschman <dsh@l...>
Subject: Re: [Caml-list] Before teaching OCaml
On Sun, Jan 07, 2007 at 07:15:22PM +0100, David Teller wrote:
> * the environment -- under Windows, is there any viable alternative to
> Emacs + the MinGW-based port ? 

OK, I'm pretty much totally new to OCaml, but maybe that's good
considering you're going to be teaching to people that are new to it,
too.

I've never used any of them, but Googling "OCaml IDE" without the quotes
brings up something called Camelia, Eclipse (they might be used to that
if they used if for Java), and Camelion.  Personally, I use Emacs, but
if you do that make sure they have Tuareg-mode installed.  I've noticed
that a lot of people who haven't used Emacs before find using the
toplevel from Emacs confusing, and usually just run ocaml as a separate
process and copy / paste code into it.  If this is the case, ledit is a
must.

> * the Makefile -- I've found OCamlMakefile [1] but I haven't tried it
> yet, hopefully it's simple enough for my students to use without too
> many arcane manipulations

Using OCamlMakefile is a no-brainer, at least for the smaller projects
I've done.

> * 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've only done a few projects in OCaml so far.  It's very good for
writing compilers / interpreters.  I find ocamllex and ocamlyacc much
friendlier than lex and yacc, and the type system makes building
abstract syntax trees a breeze.  I've been working on a mini-Prolog
interpreter for the past few weeks, and something like that might make a
good project (although, my code is on my website, so I wouldn't do that
exactly as they could easily copy it).  Before that, I implemented a
type inference system as a class project.  The professor gave us a
mini OCaml interpreter that he wrote, but removed the type inference
part of it.  It took a few weeks to do.  Since you mentioned graphics,
and OCaml is so good at writing interpreters, a thought that occurred to
me was that you could have them develop a small GUI description language
and write an interpreter for it that creates the user interface from it.
For example, something like the .rc resource files on Windows, or .glade
files (but XML is kind of boring, IMO).  The next project I am planning
to do is to write a chess playing engine, although I haven't even
decided if I'm going to use OCaml for that.  Still, alpha-beta pruning
and stuff like that should be fun to do in OCaml, although chess is a
bit complicated.  If you came up with something simpler (like checkers),
they could have their programs compete with each other (extra credit for
the winner?).

Anyway, these are just some ideas (which you asked for), that I know can
be done since I'm rather new to OCaml myself and have done or thought
about them already.  If you decide to go with one of them, you can, of
course, simplify or complicate to suit what your students can handle.

HTH :-)