Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Loup Vaillant" <loup.vaillant@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: Teaching bottomline, part 3: what should improve.
Date: Wed, 23 May 2007 10:03:29 +0200	[thread overview]
Message-ID: <6f9f8f4a0705230103r7152299esca6b56db93cfcf08@mail.gmail.com> (raw)
In-Reply-To: <4653CF5C.4040305@cs.washington.edu>

On Tue, 22 May 2007, David Teller wrote:

> * That's not OCaml-specific but there must be some construction better
> suited than "for" or "while" to write loops without having to handcode a
> recursive loops. Right now, I can't think of anything better than a
> "hidden" Y combinator, but there must be something.

What about map fold, filter, and the like? Sure, they are somewhat
specialized, but most can be rewritten for many data structures.
If you are really desperate, You can write The Recursive Loops
(terminal and not terminal, 3 lines each). But I guess you tried.


> * Arrays of arrays (of arrays...) are a bit obscure for students,
> although they're getting better at it.
>
> * Some students rely too much on references.

If they are used to for and while loops, they will think more often in
terms of references (as I did). Then, we have the array, a collection
of references. Do you think your students could learn some purely
functional data structures instead? Should they?

> * Anonymous functions are still beyond most of them.

That sounds surprising, for anonymous function are no different from named ones:

5;; (* a value *)
fun x -> x+1;; (* another value, which happens to be a function *)

a = 5;; (* a bound value *)
b = fun x -> x+1;; (* another bound value, which happens to be a function *)

Did your students used map and fold-like functions much? These almost
require anonymous functions.

regards,
Loup Vaillant


  reply	other threads:[~2007-05-23  8:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070522234715.0BCB2BC74@yquem.inria.fr>
2007-05-23  5:21 ` Dan Grossman
2007-05-23  8:03   ` Loup Vaillant [this message]
2007-05-23 12:51     ` [Caml-list] " David Teller
2007-05-24 16:30       ` Loup Vaillant
2007-05-24 18:08         ` Jon Harrop
2007-05-24 21:29         ` David Teller
2007-05-25  7:58           ` Loup Vaillant
2007-05-25  9:57           ` Markus E.L.

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=6f9f8f4a0705230103r7152299esca6b56db93cfcf08@mail.gmail.com \
    --to=loup.vaillant@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /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