Before teaching OCaml
[
Home
]
[ Index:
by date

by threads
]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
Date:   (:) 
From:  Andrej Bauer <Andrej.Bauer@f...> 
Subject:  Re: [Camllist] Before teaching OCaml 
I teach theory of programming languages with ocaml on Windows. The path of least resistance seems to be ocaml + XEmacs + tuareg + premade make files (although omake sounds like a good option). It takes one lecture (45 minutes) to explain the setup, and the first homework is "install everything and compile helloWorld.ml". If you're teaching math students who think that "java is not mathematical" enough, then you could offer mathematical projects, possibly involving graphics, such as: 1) A program that plots the graph of a function. This would involve parsing the function, so you'd have to teach basic lexing and parsing techniques. Or you can provide the lexer and parser and have them extend it with more functions. For extra credit: a program that plots surfaces in 3D. 2) A program for drawing graphs in the plane. The layout of a graph is computed with one of many algorithms, e.g. a spring embedder. You can reuse the graph data structure to develop other things (shortest path etc.) You can have a graph drawing competition. You can have them draw graphs with 10000 vertices. I once "won over" several math students from the Dark Side++ by showing them how to define the datatype of finite graphs and implement basic constructions, including computing Cayley's graph and finding the chromatic numbers (by a brute force method). They were convinced because the source code was "mathematically clean" and something like 5 times shorter than corresponding C++ would be. 3) This is shameless selfpropaganda, but several people used random art as a fun project, see e.g. Assignment 2 at http://www.cs.hmc.edu/courses/2005/fall/cs131/homework/index.html (and compare with the "real thing" at http://www.randomart.org). In this project you can avoid writing parsers, while still having abstract syntax and an interpreter, or even a compiler/optimizer. 4) If your students are very mathematical, something like the tiling examples from "Developing applications in Ocaml" might interest them. Best regards, Andrej