From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.2 required=5.0 tests=DATE_IN_PAST_24_48, SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 60626BC0A for ; Thu, 24 May 2007 15:25:41 +0200 (CEST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.250]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4ODPb2L029021 for ; Thu, 24 May 2007 15:25:39 +0200 Received: by an-out-0708.google.com with SMTP id b15so40575ana for ; Thu, 24 May 2007 06:25:37 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; b=ojsjJC17uk1z96Ilv8aCHlqybRaK6yY9gu7VPG+xTBcn2e9o+U9lKPmGOiPJP5CuTvPqMchoMdH/bKYC3qFG2rrkkxT6o+lN3SWrQKBdC99ZTDVKalt6y040qwwoHU5NsPDN0otnjW5iB6Asveu2nh9eOTp+vhSCYVTRsmp7gMc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; b=Ks7K8j+v8j13XVUawiniXUxFWf3U9A21yLmbCcZj1fh/zyq8BHUXoPYUqqkAdPtwkbunrUO9rWChVN7GxgMmig6/S7qoSRlnAtcpOerGd+l/JYBhNdVZvUXifREeybY/eVxMOAo/+UleQhglkZoWLwcvkHhj0RA6bseTLJ2SVH8= Received: by 10.100.153.17 with SMTP id a17mr1482902ane.1180013137088; Thu, 24 May 2007 06:25:37 -0700 (PDT) Received: from ?192.168.2.12? ( [24.173.161.251]) by mx.google.com with ESMTP id c23sm3716409ana.2007.05.24.06.25.35; Thu, 24 May 2007 06:25:36 -0700 (PDT) Subject: Re: [Caml-list] Re: Teaching bottomline, part 3: what should improve. From: David Teller To: Loup Vaillant Cc: caml-list@yquem.inria.fr In-Reply-To: <6f9f8f4a0705230103r7152299esca6b56db93cfcf08@mail.gmail.com> References: <20070522234715.0BCB2BC74@yquem.inria.fr> <4653CF5C.4040305@cs.washington.edu> <6f9f8f4a0705230103r7152299esca6b56db93cfcf08@mail.gmail.com> Content-Type: text/plain Date: Wed, 23 May 2007 08:51:23 -0400 Message-Id: <1179924683.6966.90.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Sender: David Teller X-Miltered: at discorde with ID 46559251.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 0200,:01 recursive:01 combinator:01 recursive:01 integers:01 syntax:01 semantics:01 2007,:98 wrote:01 wrote:01 caml-list:01 functions:01 functions:01 loops:02 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