Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Michael Vanier <mvanier@cs.caltech.edu>
To: shoh@compiler.kaist.ac.kr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Experiences with learning OCaml?
Date: Thu, 25 Nov 2004 17:46:11 -0800 (PST)	[thread overview]
Message-ID: <20041126014611.655389BDA9@orchestra.cs.caltech.edu> (raw)
In-Reply-To: <002601c4d351$74871cc0$1501a8c0@hama> (shoh@compiler.kaist.ac.kr)

> 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


  reply	other threads:[~2004-11-26  1:46 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 [this message]
2004-11-26  3:09         ` SooHyoung Oh
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=20041126014611.655389BDA9@orchestra.cs.caltech.edu \
    --to=mvanier@cs.caltech.edu \
    --cc=caml-list@inria.fr \
    --cc=shoh@compiler.kaist.ac.kr \
    /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