From: "SooHyoung Oh" <shoh@compiler.kaist.ac.kr>
To: "Michael Vanier" <mvanier@cs.caltech.edu>
Cc: <caml-list@inria.fr>
Subject: Re: [Caml-list] Experiences with learning OCaml?
Date: Fri, 26 Nov 2004 12:09:00 +0900 [thread overview]
Message-ID: <001101c4d365$4734b250$1501a8c0@hama> (raw)
In-Reply-To: <20041126014611.655389BDA9@orchestra.cs.caltech.edu>
I agree with you that the Ocaml is too complicated for a novice.
We don't have to adhere to full set of Ocaml to introduce how to program, do
we?
For HTDP, I'm planning to reduce the syntax of Ocaml,
and one example is the match-expression WITHOUT a guard.
In HTDP, chapter 4 "Conditioal expressions and Functions" seems to be a part
to teach boolean expressions and cond-expressions,
As you know, match-expressions are widly used in ocaml,
so, I think this chpater can be rewritten
to introduce booleans and subset of match-expressions.
This is why I said I need new examples.
(What about section 4.3 "Pattern-matching: Introduction",
and section 4.4 "Designing Pattern-matching Functions"?)
What I want is not to teach the syntax and semantics of one programming
langage
but to teach how to find solutions from problems and how to describe them
using a progamming language.
In my thought, Ocaml is good for such purpose
because it is a *functional* language ("functional" includes many things),
and
it has modern features such as
- simple syntax :)
- type system including polymorphism,
- module system,
- and OOP
In conclusion, I don't try to teach all functionality of Ocaml for beginners
but I'd like to show how to desing program using subset of Ocaml
from which I wish they would get some inspiration.
----- Original Message -----
From: "Michael Vanier" <mvanier@cs.caltech.edu>
To: <shoh@compiler.kaist.ac.kr>
Cc: <caml-list@inria.fr>
Sent: Friday, November 26, 2004 10:46 AM
Subject: Re: [Caml-list] Experiences with learning OCaml?
> > From: "SooHyoung Oh" <shoh@compiler.kaist.ac.kr>
> > Date: Fri, 26 Nov 2004 09:47:06 +0900
> >
> > Anyway, in my experience, the difficult parts to convert are
> > 1. cond-expression -> should be rewritten using pattern-matching; need
new
> > examples
>
> cond is very often used for the equivalent of pattern matching in scheme.
> If you need more flexibility you can always use pattern matching with a
> when clause e.g.
>
> let n = 10 in
> match n with
> | m when m < 0 -> -1
> | m when m = 0 -> 0
> | m -> 1;;
>
> > 2. symbol information -> decide which one is better? strings or varient
> > types?
>
> Symbols per se don't exist in ocaml (at least without using camlp4), and
> the whole notion of code-as-data is foreign to the ocaml world (again, not
> counting things like camlp4 and metaocaml), so some examples are going to
> be pretty hard to translate. Still, you can learn a lot by translating
> like this. I went through part 3.5 of SICP and translated the examples
> into ocaml; the results were very interesting, though haskell would have
> been more elegant for those examples because they all involved lazy
> evaluation.
>
> I'm not sure how appropriate ocaml is as a beginner's language. I teach
> both scheme and ocaml now, and ocaml is very well-liked by advanced
> programmers (one of whom came up to me raving about his "programming
> epiphany" after learning ocaml), but I think it would overwhelm beginners.
> The syntax is pretty involved, for one thing, and there are just a lot of
> concepts to learn. Cousineau and Mauny's book _The Functional Approach to
> Programming_ is a good attempt to teach functional programming and ocaml
> (actually caml-light, but it's basically the same) to a fairly naive
> audience.
>
> Mike
>
>
next prev parent reply other threads:[~2004-11-26 3:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-25 11:40 whenning
2004-11-25 11:59 ` [Caml-list] " Erik de Castro Lopo
2004-11-25 13:46 ` skaller
2004-11-25 12:28 ` chen yang
2004-11-25 13:52 ` Martin Berger
2004-11-25 13:36 ` Richard Jones
2004-11-25 20:39 ` Joshua D. Guttman
2004-11-25 20:56 ` Michael Vanier
2004-11-25 21:16 ` Danny Yoo
2004-11-26 0:16 ` Martin Berger
2004-11-26 0:15 ` Michael Walter
2004-11-26 0:47 ` SooHyoung Oh
2004-11-26 1:46 ` Michael Vanier
2004-11-26 3:09 ` SooHyoung Oh [this message]
2004-11-26 6:56 ` William Lovas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001101c4d365$4734b250$1501a8c0@hama' \
--to=shoh@compiler.kaist.ac.kr \
--cc=caml-list@inria.fr \
--cc=mvanier@cs.caltech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox