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: -- (:)
From: Jacques Carette <carette@m...>
Subject: Re: [Caml-list] Before teaching OCaml wrote:
> This was actually going to be my suggestion.  I'd suggest a very
> toned-down version of a mathematics interpreter (think of a baby
> Mathematica).  That's the kind of problem that will play well to Ocaml's
> strengths, and since you're looking at math-oriented problems, it'd be
> reasonably forward.
> It'd be really fun to do this post-abstract algebra.  Define Rings and
> that kind of stuff as functors, and then go to town.  :-D
You would think so - and then when actually doing it, realize that it 
doesn't *quite* work.  See for example

  AUTHOR = {Sylvain Boulm\'e and Th\'er\`ese Hardin and Renaud Rioboo},
  TITLE = {Polymorphic Data Types, Objects, Modules and Functors: is it too much?},
  TYPE = {Research report},
  YEAR = 2000,
  NOTE = {Available on \url{}{}},
  KEYWORDS = {classes, modules, functors, objects, types, polymorphism, functionnal programming, Computer Algebra, specification, library},
  ABSTRACT = {Abstraction is a powerful tool for developers and it is offered by numerous features such as polymorphism, classes, modules and functors, ... 
                      A working programmer may be confused with this abundance. We develop a computer algebra library which is being certified. Reporting this experience made with a
                      language (Ocaml) offering all these features, we argue that they are all needed together. We compare several ways of using classes to represent algebraic concept, 
                      trying to follow as close as possible mathematical specification. Then we show how to combine classes and modules to produce code having very strong properties. 
                      Currently, this library is made of one hundred units of functional codes and behaves faster than analogous ones such as Axiom}

To really make it 'work', you need quite a bit of technology.  You can do a toy version without getting too fancy, but you have to be careful because so many different extensions you might want to implement do not *quite* work.

I have also seen a "baby Maple" written in Haskell -- the level of necessary technology is also quite high.