caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Which syntax to teach ?
@ 2007-10-24 11:36 David Teller
  2007-10-24 13:18 ` [Caml-list] " Loup Vaillant
                   ` (4 more replies)
  0 siblings, 5 replies; 35+ messages in thread
From: David Teller @ 2007-10-24 11:36 UTC (permalink / raw)
  To: OCaml

   Hello list,

 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.

 Right now, however, that's not the issue. I'm just wondering if I
should prepare my lectures and exercises using the Original syntax or
the Revised syntax. The latest looks clearer and possibly easier to
teach but requires additional command-line arguments to ocamlc and I'm
not sure I'll be able to find an editor that will display that syntax
nicely.

 Any suggestions or experiences ?

Thanks,
 David


-- 
David Teller ------------------------------------------
Security of Distributed Systems -----------------------
Project JStify: Static Analysis for JavaScript 2  -----
-- http://www.univ-orleans.fr/lifo/Members/David.Teller
----- Laboratoire d'Informatique Fondamentale d'Orleans


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 11:36 Which syntax to teach ? David Teller
@ 2007-10-24 13:18 ` Loup Vaillant
  2007-10-24 13:24 ` Peng Zang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 35+ messages in thread
From: Loup Vaillant @ 2007-10-24 13:18 UTC (permalink / raw)
  To: David Teller; +Cc: OCaml

2007/10/24, David Teller <David.Teller@univ-orleans.fr>:
>    Hello list,
>
> [...] but requires additional command-line arguments to ocamlc


Why not just set up an alias or a little script (and an appropriate
custom toplevel)? That would ease the first lessons. For those who
want to work at home, just tell them the magic formulae. Explanations
can come later.


> not sure I'll be able to find an editor that will display that syntax
> nicely.

The Tuareg mode in emacs colours the revised syntax well. I just don't
know   how to make the embedded toplevel work properly (a trailing
";;;" problem). Maybe someone knows how to tweak it?


>  Any suggestions or experiences ?

A few. But beware: The following is a student's point of view. I don't
know how to teach. I never did.

I first learnt Caml light on its toplevel. While it is a huge helper
for learning, I wasn't told about the compiler. Therefore, I thought
the "Caml system" was closed, and useless as such.

I took two beginner courses in Caml. The first emphasised syntax
first, and the second emphasised semantics first (and actually used
very few syntactic constructs). The latter was faster and more
enjoying.

Some students need a computer at the very first lesson (my brother is
one of them). I hope you can afford it.

The word "powerful" have a semantic load that scares students.
Sentences like "It is easy to do plenty of stuff with little code"
don't.

My two cents.
Loup Vaillant


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 11:36 Which syntax to teach ? David Teller
  2007-10-24 13:18 ` [Caml-list] " Loup Vaillant
@ 2007-10-24 13:24 ` Peng Zang
  2007-10-24 13:54   ` Julien Moutinho
  2007-10-24 17:23 ` Andrej Bauer
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 35+ messages in thread
From: Peng Zang @ 2007-10-24 13:24 UTC (permalink / raw)
  To: caml-list

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I took this class:

   http://www.cs.uiuc.edu/class/fa05/cs421/current/

at UIUC and it is what got me into OCaml.  Perhaps the material on the website 
will be of use to you.

It was taught with original syntax so I'm obviously going to be partial 
towards that.  But I actually took a look at Revised syntax and thought it 
was more verbose and slightly confusing at times.  Part of what made OCaml 
attractive for me was its compactness.  Take "[x::[y::[z::t]]]" for example, 
it's quite nasty compared to just "x::y::z::t".  Now when teaching you'll 
probably want to explain how a list is nested Cons cells, and you might even 
show the former as psuedocode to help clarify the point, but then show that 
the latter is the (shorthand) syntax in OCaml and just use that.

Peng


On Wednesday 24 October 2007 07:36, David Teller wrote:
>    Hello list,
>
>  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.
>
>  Right now, however, that's not the issue. I'm just wondering if I
> should prepare my lectures and exercises using the Original syntax or
> the Revised syntax. The latest looks clearer and possibly easier to
> teach but requires additional command-line arguments to ocamlc and I'm
> not sure I'll be able to find an editor that will display that syntax
> nicely.
>
>  Any suggestions or experiences ?
>
> Thanks,
>  David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.2 (GNU/Linux)

iD8DBQFHH0ebfIRcEFL/JewRApcoAKCy6gnOYBEz2SXbYdJnrPt3K8eAzACfX3cO
5VCTSYYA73pj5kwkgPezUvQ=
=opU4
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 13:24 ` Peng Zang
@ 2007-10-24 13:54   ` Julien Moutinho
  0 siblings, 0 replies; 35+ messages in thread
From: Julien Moutinho @ 2007-10-24 13:54 UTC (permalink / raw)
  To: caml-list

On Wed, Oct 24, 2007 at 09:24:39AM -0400, Peng Zang wrote:
> Part of what made OCaml 
> attractive for me was its compactness.  Take "[x::[y::[z::t]]]" for example, 
> it's quite nasty compared to just "x::y::z::t".
See http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html#toc20
there is an other syntax: [x; y; z :: t].

By the way, the revised syntax may ease moves through the code,
due to the presence of more brackets, from which one could jump
from one to another.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 11:36 Which syntax to teach ? David Teller
  2007-10-24 13:18 ` [Caml-list] " Loup Vaillant
  2007-10-24 13:24 ` Peng Zang
@ 2007-10-24 17:23 ` Andrej Bauer
  2007-10-24 19:05   ` Adrien
  2007-10-25  9:43   ` [Caml-list] " Richard Jones
  2007-10-24 22:52 ` Nathaniel Gray
  2007-10-24 23:02 ` Jon Harrop
  4 siblings, 2 replies; 35+ messages in thread
From: Andrej Bauer @ 2007-10-24 17:23 UTC (permalink / raw)
  To: OCaml; +Cc: David Teller

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 <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 ...

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


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 17:23 ` Andrej Bauer
@ 2007-10-24 19:05   ` Adrien
  2007-10-25  5:14     ` Aleks Bromfield
  2007-10-30 16:26     ` Chung-chieh Shan
  2007-10-25  9:43   ` [Caml-list] " Richard Jones
  1 sibling, 2 replies; 35+ messages in thread
From: Adrien @ 2007-10-24 19:05 UTC (permalink / raw)
  To: Andrej.Bauer; +Cc: OCaml, David Teller

Hi,

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 <Andrej.Bauer@fmf.uni-lj.si> 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
emacs/vim.

> 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 : http://camelia.sourceforge.net/
"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 (
http://lprousnth.files.wordpress.com/2007/08/dromedary.pdf ).

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


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 11:36 Which syntax to teach ? David Teller
                   ` (2 preceding siblings ...)
  2007-10-24 17:23 ` Andrej Bauer
@ 2007-10-24 22:52 ` Nathaniel Gray
  2007-10-24 23:10   ` Jon Harrop
  2007-10-24 23:02 ` Jon Harrop
  4 siblings, 1 reply; 35+ messages in thread
From: Nathaniel Gray @ 2007-10-24 22:52 UTC (permalink / raw)
  To: David Teller; +Cc: OCaml

On 10/24/07, David Teller <David.Teller@univ-orleans.fr> wrote:
>    Hello list,
>
>  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.
>
>  Right now, however, that's not the issue. I'm just wondering if I
> should prepare my lectures and exercises using the Original syntax or
> the Revised syntax. The latest looks clearer and possibly easier to
> teach but requires additional command-line arguments to ocamlc and I'm
> not sure I'll be able to find an editor that will display that syntax
> nicely.
>
>  Any suggestions or experiences ?

As somebody who's TA'ed OCaml-based classes and read a lot of student
code I can make this recommendation: Do NOT encourage your students to
use Emacs unless you enjoy reading unindented code.  This is not a
judgment on the quality of Emacs as a tool for experts, but in the
hands of beginners (apart from highly-motivated ones) it is a source
of frustration and confusion.  They can't get auto-indenting to work.
They can't get syntax highlighting to work.  They can't get the
home/end keys to work.  They can't figure out how to cut and paste.
And thus, they produce truly horrendous code and hate the experience.
The same argument applies to vi.  These tools just do not make any
sense to people raised on modern user interfaces.

There are plenty of modern editors that can handle OCaml syntax
highlighting with no problem.  I use NEdit (you can get my
highlighting mode at n8gray.org), my colleague uses JEdit, there's
Kate, SciTE, and somebody mentioned Eclipse with OCalDE, which may
also be nice for those wanting an IDE.

I know it seems silly to devote so much energy to debating editors,
but I believe it's really important that students have a comfortable
and familiar environment in which to learn.  It's hard enough to learn
functional programming without also having to battle your text editor
every step of the way.

As for original vs. revised syntax, I'm partial to the original
syntax, but only because that's how I learned.  The error messages it
produces are problematic, however.  I do like the "reloaded" syntax
included with 3.10 that is basically original syntax with "end" after
various constructs.

Cheers,
-n8

-- 
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 11:36 Which syntax to teach ? David Teller
                   ` (3 preceding siblings ...)
  2007-10-24 22:52 ` Nathaniel Gray
@ 2007-10-24 23:02 ` Jon Harrop
  2007-10-26 11:09   ` David Teller
  4 siblings, 1 reply; 35+ messages in thread
From: Jon Harrop @ 2007-10-24 23:02 UTC (permalink / raw)
  To: caml-list

On Wednesday 24 October 2007 12:36:13 David Teller wrote:
>    Hello list,
>
>  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.

They could use FTP and a remote shell to access your Linux box from their 
Windows box.

>  Right now, however, that's not the issue. I'm just wondering if I
> should prepare my lectures and exercises using the Original syntax or
> the Revised syntax. The latest looks clearer and possibly easier to
> teach but requires additional command-line arguments to ocamlc and I'm
> not sure I'll be able to find an editor that will display that syntax
> nicely.
>
>  Any suggestions or experiences ?

I would suggest the ordinary syntax simply because it is vastly more common.

I'd also suggest giving them some working programs at the beginning of the 
course (e.g. the ray tracer and the GUI sudoku solver) and telling them that 
they'll be able to understand them by the end of the course. I found this 
kind of motivation sorely lacking on many of my courses (e.g. Greens 
functions).

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 22:52 ` Nathaniel Gray
@ 2007-10-24 23:10   ` Jon Harrop
  2007-10-25  1:48     ` skaller
  2007-10-26 11:11     ` David Teller
  0 siblings, 2 replies; 35+ messages in thread
From: Jon Harrop @ 2007-10-24 23:10 UTC (permalink / raw)
  To: caml-list

On Wednesday 24 October 2007 23:52:54 Nathaniel Gray wrote:
> I know it seems silly to devote so much energy to debating editors,

On the contrary, I find it amazing that there is no slick editor written in 
OCaml to let people write simple OCaml programs with an integrated top-level, 
build system, graphics libraries and packages for the main distros. I think 
that would be enormously beneficial for all newbies and could easily be 
available for Linux and Mac OS X as well as using the latest ocamlbuild, 
camlp4 3.10, LablGTK2 and so on.

In fact, I would say that OCaml is ideally suited to this task because it 
falls in the metaprogramming category!

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 23:10   ` Jon Harrop
@ 2007-10-25  1:48     ` skaller
  2007-10-25  2:02       ` Jon Harrop
                         ` (2 more replies)
  2007-10-26 11:11     ` David Teller
  1 sibling, 3 replies; 35+ messages in thread
From: skaller @ 2007-10-25  1:48 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list


On Thu, 2007-10-25 at 00:10 +0100, Jon Harrop wrote:
> On Wednesday 24 October 2007 23:52:54 Nathaniel Gray wrote:
> > I know it seems silly to devote so much energy to debating editors,
> 
> On the contrary, I find it amazing that there is no slick editor written in 
> OCaml to let people write simple OCaml programs with an integrated top-level, 
> build system, graphics libraries and packages for the main distros. I think 
> that would be enormously beneficial for all newbies and could easily be 
> available for Linux and Mac OS X as well as using the latest ocamlbuild, 
> camlp4 3.10, LablGTK2 and so on.
> 
> In fact, I would say that OCaml is ideally suited to this task because it 
> falls in the metaprogramming category!

Unfortunately, UI access is the problem. Who wants a GTK editor on
Windows? On OSX? On KDE?


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25  1:48     ` skaller
@ 2007-10-25  2:02       ` Jon Harrop
  2007-10-25  9:49       ` Richard Jones
  2007-11-02 16:08       ` Nathaniel Gray
  2 siblings, 0 replies; 35+ messages in thread
From: Jon Harrop @ 2007-10-25  2:02 UTC (permalink / raw)
  To: caml-list

On Thursday 25 October 2007 02:48:14 skaller wrote:
> Unfortunately, UI access is the problem. Who wants a GTK editor on
> Windows? On OSX? On KDE?

I really wouldn't mind a GTK GUI (I'm on KDE).

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 19:05   ` Adrien
@ 2007-10-25  5:14     ` Aleks Bromfield
  2007-10-30 16:26     ` Chung-chieh Shan
  1 sibling, 0 replies; 35+ messages in thread
From: Aleks Bromfield @ 2007-10-25  5:14 UTC (permalink / raw)
  To: Adrien; +Cc: Andrej.Bauer, OCaml, David Teller

On 10/24/07, Adrien <camaradetux@gmail.com> wrote:
> >From camelia's website : http://camelia.sourceforge.net/
> "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."

For the past two years, Brown has used an environment called DrOCaml,
built on top of DrScheme. It's perfect for our needs -- we use Scheme
for the first half of our intro course, and OCaml for the second, so
this saves students from having to learn a new environment halfway
through the semester. (Of course, they have to learn a new syntax
halfway through the semester, but that's another story...)

You can install DrOCaml by first installing DrScheme, and then
installing the PLT file at the URL:

http://cs.brown.edu/courses/cs017/files/drocaml.plt

If you do try this out and you experience any problems, let me know
and I'll try to fix them as soon as I get a chance.

--
Aleks Bromfield
Brown University CS
abromfie@cs.brown.edu


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 17:23 ` Andrej Bauer
  2007-10-24 19:05   ` Adrien
@ 2007-10-25  9:43   ` Richard Jones
  1 sibling, 0 replies; 35+ messages in thread
From: Richard Jones @ 2007-10-25  9:43 UTC (permalink / raw)
  To: OCaml

On Wed, Oct 24, 2007 at 07:23:07PM +0200, Andrej Bauer wrote:
> 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).

It's too much to expect that students should actually have to
learn something :-)

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25  1:48     ` skaller
  2007-10-25  2:02       ` Jon Harrop
@ 2007-10-25  9:49       ` Richard Jones
  2007-10-25 11:32         ` Stefano Zacchiroli
  2007-10-25 12:59         ` Michael Ekstrand
  2007-11-02 16:08       ` Nathaniel Gray
  2 siblings, 2 replies; 35+ messages in thread
From: Richard Jones @ 2007-10-25  9:49 UTC (permalink / raw)
  To: caml-list

Give them a bootable live CD with all the tools pre-installed and
pre-configured:

  http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo

The above tool makes it really trivial to do.

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25  9:49       ` Richard Jones
@ 2007-10-25 11:32         ` Stefano Zacchiroli
  2007-10-25 11:52           ` Daniel Bünzli
  2007-10-25 12:39           ` Richard Jones
  2007-10-25 12:59         ` Michael Ekstrand
  1 sibling, 2 replies; 35+ messages in thread
From: Stefano Zacchiroli @ 2007-10-25 11:32 UTC (permalink / raw)
  To: Inria Ocaml Mailing List

On Thu, Oct 25, 2007 at 10:49:23AM +0100, Richard Jones wrote:
> Give them a bootable live CD with all the tools pre-installed and
> pre-configured:
> 
>   http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo
> 
> The above tool makes it really trivial to do.

This is kind of a SPAM, I can't surrender to it!

Some goes ..., oh no sorry, I have to fight, ... far better you can
obtain in the .deb world with one of the following two tools:
- Debian Live: http://debian-live.alioth.debian.org/
- Ubuntu Customization Kit: http://uck.sourceforge.net/

:-)

Cheers.

-- 
Stefano Zacchiroli -*- PhD in Computer Science ............... now what?
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
(15:56:48)  Zack: e la demo dema ?    /\    All one has to do is hit the
(15:57:15)  Bac: no, la demo scema    \/    right keys at the right time


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25 11:32         ` Stefano Zacchiroli
@ 2007-10-25 11:52           ` Daniel Bünzli
  2007-10-25 12:39           ` Richard Jones
  1 sibling, 0 replies; 35+ messages in thread
From: Daniel Bünzli @ 2007-10-25 11:52 UTC (permalink / raw)
  To: Inria Ocaml Mailing List

Le 25 oct. 07 à 13:32, Stefano Zacchiroli a écrit :

> This is kind of a SPAM, I can't surrender to it!

While we are at it, this [1] live CD based on Knoppix seems to be  
tailored to teach french students. It contains a development  
environment for ocaml. Note that I never used it, I just happen to  
know its existence and I don't know anything about live CD's either.

Best,

Daniel

[1] http://www.pps.jussieu.fr/~jch/software/juppix/


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25 11:32         ` Stefano Zacchiroli
  2007-10-25 11:52           ` Daniel Bünzli
@ 2007-10-25 12:39           ` Richard Jones
  1 sibling, 0 replies; 35+ messages in thread
From: Richard Jones @ 2007-10-25 12:39 UTC (permalink / raw)
  To: Inria Ocaml Mailing List

On Thu, Oct 25, 2007 at 01:32:59PM +0200, Stefano Zacchiroli wrote:
> On Thu, Oct 25, 2007 at 10:49:23AM +0100, Richard Jones wrote:
> > Give them a bootable live CD with all the tools pre-installed and
> > pre-configured:
> > 
> >   http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo
> > 
> > The above tool makes it really trivial to do.
> 
> This is kind of a SPAM, I can't surrender to it!
> 
> Some goes ..., oh no sorry, I have to fight, ... far better you can
> obtain in the .deb world with one of the following two tools:
> - Debian Live: http://debian-live.alioth.debian.org/
> - Ubuntu Customization Kit: http://uck.sourceforge.net/

I hope that didn't come across the wrong way.  There are of course
also excellent Debian-based tools, I just didn't until now know which
were the best ones.  In any case, it sounds like giving the students a
custom live CD is going to be better than spending a whole first
lesson getting them to install and configure the required software.

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25  9:49       ` Richard Jones
  2007-10-25 11:32         ` Stefano Zacchiroli
@ 2007-10-25 12:59         ` Michael Ekstrand
  2007-10-25 13:39           ` Loup Vaillant
  2007-10-25 15:14           ` Richard Jones
  1 sibling, 2 replies; 35+ messages in thread
From: Michael Ekstrand @ 2007-10-25 12:59 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

On Thu, 25 Oct 2007 10:49:23 +0100
Richard Jones <rich@annexia.org> wrote:
> Give them a bootable live CD with all the tools pre-installed and
> pre-configured:
> 
>   http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo

Then they have to reboot, and not necessarily have access to their
files and Web bookmarks and such.

To throw another suggestion in the pot... VMware Player is free
(gratis), as is VirtualBox and some others.  If you give them a VMware
image, then they can run that alongside the rest of their stuff, on
either Windows or Linux (or perhaps Intel Mac, not quite as sure on
that one).

- Michael

-- 
mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange attachments?  I cryptographically sign my
messages. For more information see
<http://www.elehack.net/resources/gpg>.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25 12:59         ` Michael Ekstrand
@ 2007-10-25 13:39           ` Loup Vaillant
  2007-10-25 20:32             ` Andrej Bauer
  2007-10-25 15:14           ` Richard Jones
  1 sibling, 1 reply; 35+ messages in thread
From: Loup Vaillant @ 2007-10-25 13:39 UTC (permalink / raw)
  To: Michael Ekstrand; +Cc: caml-list

2007/10/25, Michael Ekstrand <michael+ocaml@elehack.net>:
> On Thu, 25 Oct 2007 10:49:23 +0100
> Richard Jones <rich@annexia.org> wrote:
> > Give them a bootable live CD with all the tools pre-installed and
> > pre-configured:
> >
> >   http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo
>
> Then they have to reboot, and not necessarily have access to their
> files and Web bookmarks and such.

Aren't a mere Notepad and toplevel sufficient? (At least for a few
weeks). It was in my classes. We learnt compilation only when we had
to write a whole project. That way, the framework can wait.

Loup Vaillant


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25 12:59         ` Michael Ekstrand
  2007-10-25 13:39           ` Loup Vaillant
@ 2007-10-25 15:14           ` Richard Jones
  2007-10-25 18:47             ` Re : " Adrien
  1 sibling, 1 reply; 35+ messages in thread
From: Richard Jones @ 2007-10-25 15:14 UTC (permalink / raw)
  To: Michael Ekstrand; +Cc: caml-list

On Thu, Oct 25, 2007 at 07:59:12AM -0500, Michael Ekstrand wrote:
> On Thu, 25 Oct 2007 10:49:23 +0100
> Richard Jones <rich@annexia.org> wrote:
> > Give them a bootable live CD with all the tools pre-installed and
> > pre-configured:
> > 
> >   http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo
> 
> Then they have to reboot, and not necessarily have access to their
> files and Web bookmarks and such.
> 
> To throw another suggestion in the pot... VMware Player is free
> (gratis), as is VirtualBox and some others.  If you give them a VMware
> image, then they can run that alongside the rest of their stuff, on
> either Windows or Linux (or perhaps Intel Mac, not quite as sure on
> that one).

Or qemu, which is not just free but Free.

http://fabrice.bellard.free.fr/qemu/download.html

``qemu -m 512 -cdrom ocaml-one-oh-one.iso -boot d'' or the equivalent
clicky-pointy thing for windows users.

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re : [Caml-list] Which syntax to teach ?
  2007-10-25 15:14           ` Richard Jones
@ 2007-10-25 18:47             ` Adrien
  0 siblings, 0 replies; 35+ messages in thread
From: Adrien @ 2007-10-25 18:47 UTC (permalink / raw)
  To: Richard Jones; +Cc: Michael Ekstrand, caml-list

2007/10/25, Richard Jones <rich@annexia.org>:
> On Thu, Oct 25, 2007 at 07:59:12AM -0500, Michael Ekstrand wrote:
> > On Thu, 25 Oct 2007 10:49:23 +0100
> > Richard Jones <rich@annexia.org> wrote:
> > > Give them a bootable live CD with all the tools pre-installed and
> > > pre-configured:
> > >
> > >   http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo
> >
> > Then they have to reboot, and not necessarily have access to their
> > files and Web bookmarks and such.
> >
> > To throw another suggestion in the pot... VMware Player is free
> > (gratis), as is VirtualBox and some others.  If you give them a VMware
> > image, then they can run that alongside the rest of their stuff, on
> > either Windows or Linux (or perhaps Intel Mac, not quite as sure on
> > that one).
>
> Or qemu, which is not just free but Free.
>
> http://fabrice.bellard.free.fr/qemu/download.html
>
> ``qemu -m 512 -cdrom ocaml-one-oh-one.iso -boot d'' or the equivalent
> clicky-pointy thing for windows users.

Having used qemu a few years ago under windows I have to say it is not
the most handy solution.
I strongly advise VirtualBox, especially against VMWare. It is faster
in all kind of applications (CPU and memory intensive operations such
as 7-zip are less than 10% slower !). It is much smaller, muuuuch
(installer is 10MB, vmware's one is ten times bigger). It is more free
(btw a big part of wirtualbox is gpl'd). Last it is a *lot* easier to
handle.


2007/10/25, Aleks Bromfield <abromfie@gmail.com>:
> For the past two years, Brown has used an environment called DrOCaml,
> built on top of DrScheme. It's perfect for our needs -- we use Scheme
> for the first half of our intro course, and OCaml for the second, so
> this saves students from having to learn a new environment halfway
> through the semester. (Of course, they have to learn a new syntax
> halfway through the semester, but that's another story...)
>
> You can install DrOCaml by first installing DrScheme, and then
> installing the PLT file at the URL:
>
> http://cs.brown.edu/courses/cs017/files/drocaml.plt
>
> If you do try this out and you experience any problems, let me know
> and I'll try to fix them as soon as I get a chance.

Thanks for the information. I'll try it this weekend. :)




As for the LiveCDs, I did not want to give any opinion but slax and
slax-like (i.e. using linux-live.org scripts) are the best from far.
I've tested a lot of them and can give some quick results.
First Ubuntu is horrible : it wouldn't start correctly ; on its time
ubuntu5 did not handle a dell inspiron 8200 which is well-spread model
with good support on linux nor did it handle a pentium4 desktop also
from dell; now the last ubuntu6 doesn't start or halt correctly with a
desktop dell P4 with 512MB and a radeon x600, an asus A6T (laptop,
turion64X2, geforce 7600Go), with a home-built A643200+, geforce
7600gt, or with a dell pentium4d, raid0, radeon X300. It also has
troubles with the majority of my hardware.
(and this hardware is very well recognized on slackware, opensuse, dsl
[2.4 kernels], self-compiled stripped kernels, ...)
It is also really slow (three last computers all have 2GB memory).

Next, gentoo or red hat livecds are better but still too big. Of
course they have everything but that's the problem. You don't want
20MB of wallpapers on a livecd and don't want an haskell compiler or
gcj either when you're doing ocaml.

As for juppix it weighs 700MB (it contains a java sdk...).

Linux-live scripts on the other hand makes people create slick
systems. I use slackware and the systems I create for livecds are less
than 600MB on disk.
Then you have lzma compression which saves a lot of space which means
less date to read from the cd and which is nearly instant to
decompress.
The approach also uses modules. This way it is possible to load things
on-demand and save memory (today I killed linux on a livecd because I
did not have enough memory)

Sorry for the rant I just don't understand how it is possible to still
create and use mastodon such as knoppixes* when there are better
solutions.
* it's great but has more things on it than a default opensuse installation...


@Dirk Thierbach, thanks a lot.
Actually I had to use emacs today because I forgot my laptop and your
answer has helped me. =P


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25 13:39           ` Loup Vaillant
@ 2007-10-25 20:32             ` Andrej Bauer
  2007-10-25 22:11               ` Loup Vaillant
  0 siblings, 1 reply; 35+ messages in thread
From: Andrej Bauer @ 2007-10-25 20:32 UTC (permalink / raw)
  To: caml-list; +Cc: Loup Vaillant

Loup Vaillant wrote:
> Aren't a mere Notepad and toplevel sufficient? (At least for a few
> weeks).

No, because cut & paste does not work in the windows version of ocaml
toplevel. It is a nightmare for beginners. I speak from experience, so
apparently we have different experiences.

Andrej


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25 20:32             ` Andrej Bauer
@ 2007-10-25 22:11               ` Loup Vaillant
  0 siblings, 0 replies; 35+ messages in thread
From: Loup Vaillant @ 2007-10-25 22:11 UTC (permalink / raw)
  To: Andrej.Bauer; +Cc: caml-list

2007/10/25, Andrej Bauer <Andrej.Bauer@fmf.uni-lj.si>:
> Loup Vaillant wrote:
> > Aren't a mere Notepad and toplevel sufficient? (At least for a few
> > weeks).
>
> No, because cut & paste does not work in the windows version of ocaml
> toplevel. It is a nightmare for beginners. I speak from experience, so
> apparently we have different experiences.

Oh, s***. Now you remind me, I did have problems with this. It really
needs a fix.

Emacs's Tuareg mode works fine, though. Too bad it's not an option.
(Well, at least, a clueless newbe have a fighting chance with it,
unlike vi.)

As a last resort, the Camllight toplevel don't have the cut/paste
problem. Unless the students are to use functors, classes, or do
foreign calls, chances are that Camllight is enough, even for a fairly
big project. The differences between Ocaml and Camllight are tiny, so
switching to Ocaml later should not cause any problem.

Loup


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 23:02 ` Jon Harrop
@ 2007-10-26 11:09   ` David Teller
  0 siblings, 0 replies; 35+ messages in thread
From: David Teller @ 2007-10-26 11:09 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list

On Thu, 2007-10-25 at 00:02 +0100, Jon Harrop wrote:
> They could use FTP and a remote shell to access your Linux box from their 
> Windows box.

Not feasible, I'm afraid, as the university won't let me put a server
accessible from the outside.

> I'd also suggest giving them some working programs at the beginning of the 
> course (e.g. the ray tracer and the GUI sudoku solver) and telling them that 
> they'll be able to understand them by the end of the course. I found this 
> kind of motivation sorely lacking on many of my courses (e.g. Greens 
> functions).

Interesting idea. I'll keep it in mind, thanks.

Cheers,
 David


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-24 23:10   ` Jon Harrop
  2007-10-25  1:48     ` skaller
@ 2007-10-26 11:11     ` David Teller
  1 sibling, 0 replies; 35+ messages in thread
From: David Teller @ 2007-10-26 11:11 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list

I am considering putting a pair of students on writing a simple GUI for
OCaml based on Chris King's functional reactive GUI, itself based on
Gtk. However, it seems unlikely to me that, at their level, they can
carry on that task in just one term -- and that's all the time they'll
have to learn OCaml and complete their projects.

Cheers,
 David

On Thu, 2007-10-25 at 00:10 +0100, Jon Harrop wrote:
> On Wednesday 24 October 2007 23:52:54 Nathaniel Gray wrote:
> > I know it seems silly to devote so much energy to debating editors,
> 
> On the contrary, I find it amazing that there is no slick editor written in 
> OCaml to let people write simple OCaml programs with an integrated top-level, 
> build system, graphics libraries and packages for the main distros. I think 
> that would be enormously beneficial for all newbies and could easily be 
> available for Linux and Mac OS X as well as using the latest ocamlbuild, 
> camlp4 3.10, LablGTK2 and so on.
> 
> In fact, I would say that OCaml is ideally suited to this task because it 
> falls in the metaprogramming category!
> 


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Which syntax to teach ?
  2007-10-24 19:05   ` Adrien
  2007-10-25  5:14     ` Aleks Bromfield
@ 2007-10-30 16:26     ` Chung-chieh Shan
  2007-10-30 16:38       ` [Caml-list] " Brian Hurt
  2007-10-30 18:56       ` Daniel Bünzli
  1 sibling, 2 replies; 35+ messages in thread
From: Chung-chieh Shan @ 2007-10-30 16:26 UTC (permalink / raw)
  To: caml-list

Adrien <camaradetux@gmail.com> wrote in article <666572260710241205x19edbd4ar840811b1d7a7315f@mail.gmail.com> in gmane.comp.lang.caml.inria:
> > 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.

Any tips on how (and perhaps how not) to teach functors?  I'm using a
Haskell equivalent of functors (namely constructor classes) in an AI
class (!) and they seem to be mysterious.  It didn't seem to work to
explain the Java/C# code that I would like to write (but can't, because
these languages have no interface _on_ generics (as opposed to generic
interfaces)).

> I just don't get the importance of functors.

I use them to provide multiple interpretations of the same abstract
construction (each interpretation is a module and each abstract
construction is a functor from interpretation modules to result
modules).  Here is a description of a simple example:
http://conway.rutgers.edu/~ccshan/wiki/blog/posts/Translations/

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
One can show you aren't immediately killed by tidal forces once crossing
over the event horizon of Black Hole. Mathematically, your space coordinates
become time-like and vice versa. This causes a shift in your light
cone and your world line can never intersect with someone on the outside.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Re: Which syntax to teach ?
  2007-10-30 16:26     ` Chung-chieh Shan
@ 2007-10-30 16:38       ` Brian Hurt
  2007-10-30 16:59         ` Chung-chieh Shan
  2007-10-30 17:08         ` [Caml-list] " Edgar Friendly
  2007-10-30 18:56       ` Daniel Bünzli
  1 sibling, 2 replies; 35+ messages in thread
From: Brian Hurt @ 2007-10-30 16:38 UTC (permalink / raw)
  To: Chung-chieh Shan; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]

Chung-chieh Shan wrote:

>Adrien <camaradetux@gmail.com> wrote in article <666572260710241205x19edbd4ar840811b1d7a7315f@mail.gmail.com> in gmane.comp.lang.caml.inria:
>  
>
>>>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.
>>>      
>>>
>
>Any tips on how (and perhaps how not) to teach functors?  I'm using a
>Haskell equivalent of functors (namely constructor classes) in an AI
>class (!) and they seem to be mysterious.  It didn't seem to work to
>explain the Java/C# code that I would like to write (but can't, because
>these languages have no interface _on_ generics (as opposed to generic
>interfaces)).
>
>  
>
Not sure how well this would work, but my idea would be to map the 
concepts onto the standard code concepts.

For example,
module type Foo = sig ... end;;
maps to:
type foo = ...;;

module Foo = struct ... end;;
maps to:
let foo = ...;;

module Foo(Bar: Baz) : Quux = struct ... end;;
maps to:
let foo (bar: baz) : quux = ...;;

and so on.  Functors, then, are a way to manipulate modules, in the same 
way that functions are a way to manipulate values.

Brian


[-- Attachment #2: Type: text/html, Size: 1997 bytes --]

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Which syntax to teach ?
  2007-10-30 16:38       ` [Caml-list] " Brian Hurt
@ 2007-10-30 16:59         ` Chung-chieh Shan
  2007-10-30 17:08         ` [Caml-list] " Edgar Friendly
  1 sibling, 0 replies; 35+ messages in thread
From: Chung-chieh Shan @ 2007-10-30 16:59 UTC (permalink / raw)
  To: caml-list

Brian Hurt <bhurt@janestcapital.com> wrote in article <47275E10.4070705@janestcapital.com> in gmane.comp.lang.caml.inria:
> Not sure how well this would work, but my idea would be to map the 
> concepts onto the standard code concepts. [...]

I guess the issue then boils down to how to teach higher-kinded
polymorphism, that is, functions that are polymorphic over a type
*constructor*.  It is crucial for me that the functor's argument module
contain an abstract type *constructor*.

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
One can show you aren't immediately killed by tidal forces once crossing
over the event horizon of Black Hole. Mathematically, your space coordinates
become time-like and vice versa. This causes a shift in your light
cone and your world line can never intersect with someone on the outside.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Re: Which syntax to teach ?
  2007-10-30 16:38       ` [Caml-list] " Brian Hurt
  2007-10-30 16:59         ` Chung-chieh Shan
@ 2007-10-30 17:08         ` Edgar Friendly
  2007-10-30 17:56           ` skaller
                             ` (2 more replies)
  1 sibling, 3 replies; 35+ messages in thread
From: Edgar Friendly @ 2007-10-30 17:08 UTC (permalink / raw)
  To: Brian Hurt; +Cc: Chung-chieh Shan, caml-list

Brian Hurt wrote:
> Chung-chieh Shan wrote:
> 
>> Any tips on how (and perhaps how not) to teach functors?  I'm using a
>> Haskell equivalent of functors (namely constructor classes) in an AI
>> class (!) and they seem to be mysterious.  It didn't seem to work to
>> explain the Java/C# code that I would like to write (but can't, because
>> these languages have no interface _on_ generics (as opposed to generic
>> interfaces)).
>>
> Not sure how well this would work, but my idea would be to map the
> concepts onto the standard code concepts.
> 
<SNIP>
> and so on.  Functors, then, are a way to manipulate modules, in the same
> way that functions are a way to manipulate values.
> 
> Brian
> 
> 
That's more or less how I think of them.  Functions can be written with
"holes" to fill in with their parameters.  In the same way, modules can
have these "empty puzzle-spaces" that, once you fit the right kind of
puzzle piece (module of the right type), you can plug it in (apply the
functor) to get a full module.  Sort of like how you can do partial
application with functions to get exactly the function you want.  i.e.

let sum_int = fold_left (+) 0

Functors/generics fill a much bigger hole in other languages, because in
Ocaml it's possible to pass each piece of the parameter module to each
of the contained functional values, and because of polymorphic
functions, we don't need functors to abstract over types as much.  I
guess you could teach it like extra arguments to every function in your
functor, I don't know if that'd help your students.

E.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Re: Which syntax to teach ?
  2007-10-30 17:08         ` [Caml-list] " Edgar Friendly
@ 2007-10-30 17:56           ` skaller
  2007-10-30 19:02             ` Vincent Aravantinos
  2007-10-30 18:50           ` William D. Neumann
  2007-10-30 21:45           ` Eliot Handelman
  2 siblings, 1 reply; 35+ messages in thread
From: skaller @ 2007-10-30 17:56 UTC (permalink / raw)
  To: Edgar Friendly; +Cc: Brian Hurt, caml-list, Chung-chieh Shan


On Tue, 2007-10-30 at 12:08 -0500, Edgar Friendly wrote:
> Brian Hurt wrote:
> > Chung-chieh Shan wrote:
> > 
> >> Any tips on how (and perhaps how not) to teach functors? 

The problem teaching functors is that the essential feature
of functors is missing -- a functor is a structure preserving
map but there's no way to specify any structure other than
in comments.


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Re: Which syntax to teach ?
  2007-10-30 17:08         ` [Caml-list] " Edgar Friendly
  2007-10-30 17:56           ` skaller
@ 2007-10-30 18:50           ` William D. Neumann
  2007-10-30 21:45           ` Eliot Handelman
  2 siblings, 0 replies; 35+ messages in thread
From: William D. Neumann @ 2007-10-30 18:50 UTC (permalink / raw)
  To: Edgar Friendly, Brian Hurt; +Cc: caml-list, Chung-chieh Shan

On Tue, 30 Oct 2007 12:08:16 -0500, Edgar Friendly wrote

> That's more or less how I think of them.  Functions can be written with
> "holes" to fill in with their parameters.  In the same way, modules can
> have these "empty puzzle-spaces" that, once you fit the right kind of
> puzzle piece (module of the right type), you can plug it in (apply 
> the functor) to get a full module.

Unfortunately, on top of what one sees with HOFs, functors have a bit more 
baggage associated with learning how to use them effectively.  For one 
thing, the language is just different enough from the rest of OCaml to be a 
nuicance. And all of the extra bits needed to get the types to play nicely 
can really be hard to get a hold of (making types work as expected/desired 
seems to account for ~90% of the functor related questions to the mailing 
lists), and there's very little written up about it available for people to 
look at; section 2.4 of the manual only goes so far.

--

William D. Neumann


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Re: Which syntax to teach ?
  2007-10-30 16:26     ` Chung-chieh Shan
  2007-10-30 16:38       ` [Caml-list] " Brian Hurt
@ 2007-10-30 18:56       ` Daniel Bünzli
  1 sibling, 0 replies; 35+ messages in thread
From: Daniel Bünzli @ 2007-10-30 18:56 UTC (permalink / raw)
  To: caml-list caml-list


Le 30 oct. 07 à 17:26, Chung-chieh Shan a écrit :

> Any tips on how (and perhaps how not) to teach functors?

Once they know what polymorphism is, make them realize it is  
sometimes useful, to write generic code, to be able to assume the  
existence of certain operations on a polymorphic type variable. But  
polymorphism doesn't allow this. Introduce functors as the way of  
acheiving this, i.e. the way to abstract a type with particular  
operations from a module implementation.

Best,

Daniel


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Re: Which syntax to teach ?
  2007-10-30 17:56           ` skaller
@ 2007-10-30 19:02             ` Vincent Aravantinos
  0 siblings, 0 replies; 35+ messages in thread
From: Vincent Aravantinos @ 2007-10-30 19:02 UTC (permalink / raw)
  To: skaller; +Cc: Gurus Ocaml


Le 30 oct. 07 à 18:56, skaller a écrit :

> On Tue, 2007-10-30 at 12:08 -0500, Edgar Friendly wrote:
>> Brian Hurt wrote:
>>> Chung-chieh Shan wrote:
>>>
>>>> Any tips on how (and perhaps how not) to teach functors?
>
> The problem teaching functors is that the essential feature
> of functors is missing -- a functor is a structure preserving
> map but there's no way to specify any structure other than
> in comments.

Indeed, I don't really see the link between Ocaml functors and  
Category ones (???). Could someone explain this ?

Classically, types would be the objects and functions would be the  
arrows. But then a functor does not map a type to each original type  
neither a function to each original function. So what ?

Maybe we could see all the module structures associated to a module  
signature form a category ? And then a (ocaml) functor would indeed  
be a (category) functor from the category associated to the signature  
of the parameter to the category of its returned module type. (?)

Is this the way to go ? I thing I've read once that it was linked  
with "institutions" theory (of Goguen), is this right ?

Thanks for answers,
Vincent

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Re: Which syntax to teach ?
  2007-10-30 17:08         ` [Caml-list] " Edgar Friendly
  2007-10-30 17:56           ` skaller
  2007-10-30 18:50           ` William D. Neumann
@ 2007-10-30 21:45           ` Eliot Handelman
  2 siblings, 0 replies; 35+ messages in thread
From: Eliot Handelman @ 2007-10-30 21:45 UTC (permalink / raw)
  To: caml; +Cc: Chung-chieh Shan


>
>>> Chung-chieh Shan wrote:
>>>
>>>       
>>>> Any tips on how (and perhaps how not) to teach functors? 
>>>>         
>
>   
Here's a way of motivating functors that I found useful when trying to 
understand them.


In some languages, eg scheme, we can write something like:

(define (solve) (oracle))
(define (oracle) (display "this is the oracle speaking.") (newline))

where solve in defined before its component, oracle. We only get an 
error if we try to call solve before
oracle has been defined; otherwise the compiler is happy. But in ocaml 
we can't even get that far, because the compiler
needs to know what oracle is before it can compile solve.

This leads to the problem of having to know all of the components of a 
thing before we can define it.
But this can lead to inflexibility, because we may wish to describe some 
top-level behavior
before getting into the particulars. What we can do is to describe the 
parts we need as a signature.
The signature is input to a functor. We can then refer to the missing 
parts through the signature. A further
benefit is that the definition of oracle is left to an awaited moment of 
inspiration

-- eliot


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [Caml-list] Which syntax to teach ?
  2007-10-25  1:48     ` skaller
  2007-10-25  2:02       ` Jon Harrop
  2007-10-25  9:49       ` Richard Jones
@ 2007-11-02 16:08       ` Nathaniel Gray
  2 siblings, 0 replies; 35+ messages in thread
From: Nathaniel Gray @ 2007-11-02 16:08 UTC (permalink / raw)
  To: skaller; +Cc: Jon Harrop, caml-list

I'm using a Motif editor on OS X, so GTK would be a big step up,
particularly if it used native widgets!  ;^)

-n8

On 10/24/07, skaller <skaller@users.sourceforge.net> wrote:
>
> On Thu, 2007-10-25 at 00:10 +0100, Jon Harrop wrote:
> > On Wednesday 24 October 2007 23:52:54 Nathaniel Gray wrote:
> > > I know it seems silly to devote so much energy to debating editors,
> >
> > On the contrary, I find it amazing that there is no slick editor written in
> > OCaml to let people write simple OCaml programs with an integrated top-level,
> > build system, graphics libraries and packages for the main distros. I think
> > that would be enormously beneficial for all newbies and could easily be
> > available for Linux and Mac OS X as well as using the latest ocamlbuild,
> > camlp4 3.10, LablGTK2 and so on.
> >
> > In fact, I would say that OCaml is ideally suited to this task because it
> > falls in the metaprogramming category!
>
> Unfortunately, UI access is the problem. Who wants a GTK editor on
> Windows? On OSX? On KDE?
>
>
> --
> John Skaller <skaller at users dot sf dot net>
> Felix, successor to C++: http://felix.sf.net
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


-- 
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->


^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2007-11-02 16:08 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-24 11:36 Which syntax to teach ? David Teller
2007-10-24 13:18 ` [Caml-list] " Loup Vaillant
2007-10-24 13:24 ` Peng Zang
2007-10-24 13:54   ` Julien Moutinho
2007-10-24 17:23 ` Andrej Bauer
2007-10-24 19:05   ` Adrien
2007-10-25  5:14     ` Aleks Bromfield
2007-10-30 16:26     ` Chung-chieh Shan
2007-10-30 16:38       ` [Caml-list] " Brian Hurt
2007-10-30 16:59         ` Chung-chieh Shan
2007-10-30 17:08         ` [Caml-list] " Edgar Friendly
2007-10-30 17:56           ` skaller
2007-10-30 19:02             ` Vincent Aravantinos
2007-10-30 18:50           ` William D. Neumann
2007-10-30 21:45           ` Eliot Handelman
2007-10-30 18:56       ` Daniel Bünzli
2007-10-25  9:43   ` [Caml-list] " Richard Jones
2007-10-24 22:52 ` Nathaniel Gray
2007-10-24 23:10   ` Jon Harrop
2007-10-25  1:48     ` skaller
2007-10-25  2:02       ` Jon Harrop
2007-10-25  9:49       ` Richard Jones
2007-10-25 11:32         ` Stefano Zacchiroli
2007-10-25 11:52           ` Daniel Bünzli
2007-10-25 12:39           ` Richard Jones
2007-10-25 12:59         ` Michael Ekstrand
2007-10-25 13:39           ` Loup Vaillant
2007-10-25 20:32             ` Andrej Bauer
2007-10-25 22:11               ` Loup Vaillant
2007-10-25 15:14           ` Richard Jones
2007-10-25 18:47             ` Re : " Adrien
2007-11-02 16:08       ` Nathaniel Gray
2007-10-26 11:11     ` David Teller
2007-10-24 23:02 ` Jon Harrop
2007-10-26 11:09   ` David Teller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).