Browse thread
Re: Teaching bottomline, part 3: what should improve.
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | David Teller <David.Teller@e...> |
| Subject: | Re: [Caml-list] Re: Teaching bottomline, part 3: what should improve. |
On Wed, 2007-05-23 at 10:03 +0200, Loup Vaillant wrote: > 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. I was thinking about a fold specialised in integers. But with a "better" syntax and semantics than either fold (i.e. no anonymous functions) or for (i.e. no reliance on references). Of course, I don't have such a construction at hand. > > * 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? There is such a thing as relying *too much* on references. > > * Anonymous functions are still beyond most of them. [...] > Did your students used map and fold-like functions much? These almost > require anonymous functions. That's the thing: anonymous functions are not natural for them, hence map, fold et al. are not natural. Regards, David