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=1.0 required=5.0 tests=AWL,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 3A463BC0A for ; Wed, 23 May 2007 10:03:43 +0200 (CEST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.248]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4N83gQQ017002 for ; Wed, 23 May 2007 10:03:42 +0200 Received: by an-out-0708.google.com with SMTP id b15so27728ana for ; Wed, 23 May 2007 01:03:30 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LJBSCAABZITmXG3XROSJLcy0wcqPit0/t2DXRtwk+ZJjEb8tO6BbPPgreOMo+FJvhZvIwczF+NCtaA+DVJ0ggltg9YqPGaE2Sv0d0U+ZCHvmOHssIp2b/b32Eecw/Jjvsa4qDVApQ7wAr7uhr6C7RrS3pYdGp8gZ+AZV2l7pOw0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=r3a1COHXjp6jee2m+L/+OxwNZn29uHshLAcjJacEn5sunpKl13mI6bqyOS147n/1OyLxuU9tX/6g7blSlhaHaTdOR9ZIjrMdW4VcvDcW+msuN1MxcdSx3cETOtRDiq0J6iw5c5xPT7WcGDv2dxSTDdYsNlDE7EzNZbp7U62zCnQ= Received: by 10.100.8.18 with SMTP id 18mr191288anh.1179907410016; Wed, 23 May 2007 01:03:30 -0700 (PDT) Received: by 10.100.168.16 with HTTP; Wed, 23 May 2007 01:03:29 -0700 (PDT) Message-ID: <6f9f8f4a0705230103r7152299esca6b56db93cfcf08@mail.gmail.com> Date: Wed, 23 May 2007 10:03:29 +0200 From: "Loup Vaillant" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Teaching bottomline, part 3: what should improve. In-Reply-To: <4653CF5C.4040305@cs.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070522234715.0BCB2BC74@yquem.inria.fr> <4653CF5C.4040305@cs.washington.edu> X-j-chkmail-Score: MSGID : 4653F55E.003 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4653F55E.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; recursive:01 combinator:01 recursive:01 arrays:01 arrays:01 2007,:98 wrote:01 caml-list:01 functions:01 functions:01 surprising:01 loops:02 loops:02 data:02 data:02 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