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
Which syntax to teach ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-10-24 (19:05)
From: Adrien <camaradetux@g...>
Subject: Re: [Caml-list] Which syntax to teach ?

I'm currently a student (prépa MP, 3/2) and I've been doing (o)caml
for less than one year. I've recognized my personnal situation or some
of my friend's one in what Andrej wrote. As such I thought I could
contribute a bit. ;)

A quick note first : for many of us this was our first programming
language (not for me though) and we only have two hours per week ; the
focus is not application developpment (i.e. we're light-years before
ocamlbuild and other refinements).

On 2007/10/24, Andrej Bauer <> wrote:
> 1. Students want to use Microsoft Windows

They don't *want* to use windows. They just don't get why they should
use linux with its command-lines, its new interfaces, its availability
when windows seems alright especially with the availability of
binaries for both caml-light and ocaml (they think everything works
under windows and nothing under linux which is just an operating
system for geeks [nearly quoting]).
As far as I'm concerned, I've had some bad experiences with \r\n
translations for ocaml under windows and vim simply r0x but this won't
convert many people to linux.

> 2. Students HATE Emacs because its basic behavior regarding selections,
>    cut & paste is counter-intuitive to them.

I agree and there are other reasons too : I still don't know how to
properly create, open, save a file or run the toplevel in emacs (I now
bring my own laptop with vim ;p ). In fact you can easily understand
vim's :w (*w*rite), :q (*q*uit), :n (*n*ew), :e (*e*dit) but I am
under the impression there is no such logic under emacs.
Plus menus for the gui don't help as they use abbrevations and
sequences I still don't get (and it's not very pretty).
Last emacs is made for qwerty keyboards, not azerty ones. For instance
ctrl+w is hard to do on such keyboards and if you need a percent sign
you're stuck.

I don't want to say vim is better than emacs. Both have a different
logic which are different from anything your students probably know.
Teaching ocaml is often enough on its own not to have to teach

> 3. Students think Make is an archaic nuisance (and they're right).
> So this year we switched to Eclipse + OcaIDE + ocamlbuild. As long as
> you instruct your students to install (in this order!)
>   Cygwin
>   Ocaml 3.10 (not from cygwin package manager!)
>   Java 1.6
>   Eclipse 3.2
>   OcaIDE
> on their home computers, they should be fine. This year students have
> much less initial trouble. (The combination cygwin + XEmacs + tuareg +
> ocaml + Make was a real nightmare in previous years.)

You can probably use a livecd with ocaml preinstalled and distribute
it to your students.
This is a viable solution especially since ntfs-3g is now stable so
they can write on their hard disks.
Moreover there is now camelia, cameleon2 and a third one which name
I've forgotten. They should all be simpler than emacs.
>From camelia's website :
"Camelia started out as a tool to help students in Brown University's
CS17 have an easier time making the leap from Scheme to OCaml. It's
meant to make writing in OCaml relatively painless without having to
learn the nuances of a powerful editor like Emacs or VI."
Last for the future, dromedary's "types as you type" is particularly
appealing but not ready yet afaik ( ).

The one available now is quite old but I'm doing one myself from
scratch. In fact I've already done one but this was my first try and
though it worked pretty well it could be better. I want to have it run
on machines with 256MB of memory, including macs (the intel-based ones
but which have an EFI instead of a BIOS).
I'd like to have it ready in two weeks (I have some holidays starting
on saturday).

> [...]
> 3. The following is confusing to beginners:
> let f x = function <cases>
> They think it's a function of one variable. When asked to define a
> function of two variables, they might write
> let g x y = function <cases>
> So I always start strictly with the form
> let f x =
>   match x with
>    <cases>
> let g x y =
>   match y with
>    <cases>
> Then I teach "shorthands"
> let f = function ...
> let g x = function ...

I can perfectly back this up : our teacher had a simple solution not
to confuse us : not teach it. When I learned this, I asked him for
details and in turn a girl asked me about this ; she did not get it.
The first solution is longer and less sexy but safer especially for
beginners (now I read the  "=function <cases>" better since it can be
read just like in mathematics).

> 7. They easily understand how the standard library is used (but not the
> functors), the open statement, the fact that a program may be in several
> .ml files. The .mli files are a bit more mysterious. Functors are _very_
> mysterious.

I have to say I'm in this situation (theorically i should know nothing
about functors but I'm curious ;) ).
I'm curious but functors seem to be a big chunk and I really wonder
why they are so good. I enjoy functionnal programming, I understand
why it is interesting to prove programs and can sometimes do this on
my own, I want the mathematical background but I just don't get the
importance of functors.
I'm not representative of all students but I need to understand the
necessity or the use of something to understand it. Otherwise I just
say "ok, we have this, and ... next ?".

Good luck with your students, these youngs are all evil. =P


Adrien Nader