From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 4B571BC69 for ; Wed, 24 Oct 2007 19:22:42 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAF8cH0fAXQImh2dsb2JhbACOWgIBCAop X-IronPort-AV: E=Sophos;i="4.21,325,1188770400"; d="scan'208";a="3604144" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 24 Oct 2007 19:22:42 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l9OHMaXl031368 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 24 Oct 2007 19:22:41 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CANobH0fBAkMt/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.21,325,1188770400"; d="scan'208";a="3564222" Received: from vega.fmf.uni-lj.si (HELO postar.fmf.uni-lj.si) ([193.2.67.45]) by mail2-smtp-roc.national.inria.fr with ESMTP; 24 Oct 2007 19:22:41 +0200 Received: from localhost (unknown [192.168.5.1]) by postar.fmf.uni-lj.si (Postfix) with ESMTP id D95691AAFB6; Wed, 24 Oct 2007 19:22:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at spam.fmf.uni-lj.si Received: from postar.fmf.uni-lj.si ([192.168.5.5]) by localhost (spam.fmf.uni-lj.si [192.168.5.1]) (amavisd-new, port 10024) with ESMTP id UrcpqVzE+fb8; Wed, 24 Oct 2007 19:22:40 +0200 (CEST) Received: from [192.168.1.101] (BSN-77-148-136.static.dsl.siol.net [193.77.148.136]) (Authenticated sender: bauer) by postar.fmf.uni-lj.si (Postfix) with ESMTP id 5D2EC1AAE19; Wed, 24 Oct 2007 19:22:39 +0200 (CEST) Message-ID: <471F7F7B.9040905@fmf.uni-lj.si> Date: Wed, 24 Oct 2007 19:23:07 +0200 From: Andrej Bauer Reply-To: Andrej.Bauer@andrej.com User-Agent: Thunderbird 1.5.0.13 (X11/20070824) MIME-Version: 1.0 To: OCaml Cc: David Teller Subject: Re: [Caml-list] Which syntax to teach ? References: <1193225773.3612.27.camel@Blefuscu> In-Reply-To: <1193225773.3612.27.camel@Blefuscu> Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 471F7F5C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; andrej:01 andrej:01 syntax:01 ocaml:01 ocaml:01 emacs:01 cygwin:01 cygwin:01 tuareg:01 syntax:01 trivial:01 variants:01 functors:01 mli:01 functors:01 David Teller wrote: > In a few months, I'll start teaching OCaml for the second consecutive > year. I'll solve a number of my problems by installing Linux on the > workstations, although I'm pretty sure that will cause no end of > complaints from the students when they need to continue their work at > home. My experience with teaching theory of programming languages, where we implement mini interpreters and compilers with Ocaml: 1. Students want to use Microsoft Windows. 2. Students HATE Emacs because its basic behavior regarding selections, cut & paste is counter-intuitive to them. 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.) Even though OcaIDE is sort of half-done and ocamlbuild is very Unix-centric, it's still a useful combination. As far as teaching ocaml goes, here are a few tips: 1. Do not bore them with syntax. They will just absorb it, and it doesn't matter which version it is, so pick the one that does not require extra options and settings. There are a few traps they will fall into--when they do, explain what is going on. With time you will be able to anticipate them. 2. Point out differences with programming languages they know, e.g.: - you can put if-then-else _anywhere_ - you can put local definitions _anywhere_ - "let x = .. in .." defines an _immutable_ value x - functions don't have a "return" statement, you just write the result, like you do in math 3. The following is confusing to beginners: let f x = function 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 So I always start strictly with the form let f x = match x with let g x y = match y with Then I teach "shorthands" let f = function ... let g x = function ... 4. You will be sorry if they know Java and you teach them early about references, assignments and loops. 5. Explain ahead of time why things like List.nth lst (List.length lst - 1) are bad. From Java they know it's trivial to access the n-th component and to find out the size of a container. 6. Special care is needed in explaining and advertising sum types (variants) because they only exist in mutilated form in commonly used languages. 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. 8. Error messages come from hell. They are a big hurdle and you need to devote special attention to them. Best regards, Andrej