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=0.7 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, SUBJ_HAS_SPACES 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 599D9BC6B for ; Wed, 23 May 2007 16:06:42 +0200 (CEST) Received: from smtp005.mail.ukl.yahoo.com (smtp005.mail.ukl.yahoo.com [217.12.11.36]) by discorde.inria.fr (8.13.6/8.13.6) with SMTP id l4NE6fka003334 for ; Wed, 23 May 2007 16:06:41 +0200 Received: (qmail 19888 invoked from network); 23 May 2007 14:06:41 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Received:X-YMail-OSG:Mime-Version:In-Reply-To:References:Content-Type:Message-Id:Content-Transfer-Encoding:From:Subject:Date:To:X-Mailer; b=TD07zxs74/YPODTKDfzYaLr9tdZ7UDhBIi1plkQ9JMvsslDJHok1KB9010jaRcnJNZhAYy9XBi0AV47LtrrEUQgCC4w56e56mzB/2ROBovPe9l1lDVqq5vXgQx8DL8uGihpC5mQgmvdH4A04FBhK9YSJiERk7T5OFu2KwMYsqPs= ; Received: from unknown (HELO ?192.168.0.10?) (vincent.aravantinos@82.229.199.66 with plain) by smtp005.mail.ukl.yahoo.com with SMTP; 23 May 2007 14:06:41 -0000 X-YMail-OSG: JS76P68VM1kTTyeYeKbSwuPsmu97iWIMIKKBtcashu3W8dWF Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <20070523132200.F3857BC82@yquem.inria.fr> References: <20070523132200.F3857BC82@yquem.inria.fr> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <7CCAC698-FAB7-4F38-8EC3-6ED142DFE321@yahoo.fr> Content-Transfer-Encoding: 7bit From: Vincent Aravantinos Subject: Re: [Caml-list] Re: Re: Teaching bottomline, part 3: what should improve. Date: Wed, 23 May 2007 16:04:54 +0200 To: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.752.2) X-Miltered: at discorde with ID 46544A71.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 syntax:01 functionnal:01 derivation:01 usefulness:01 ocaml:01 beginner's:01 abstraction:01 23,:98 2007,:98 beginners:01 closures:01 wrote:01 imho:01 caml-list:01 > Date: Wed, 23 May 2007 15:21:55 +0200 > From: "Loup Vaillant" > Subject: Re: [Caml-list] Re: Re: Teaching bottomline, part 3: what > should improve. > > 2007/5/23, Vincent Aravantinos : >> On Wed, 23 May 2007, Loup Vaillant wrote : >> >>> (...) >> >>>> * 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 *) >> >> Those are typically the comments of a "used-to-functional- >> programming" guy. >> It certainly doesn't match what a beginner would think (no beginner >> will call a >> function a "value"). > > You are quite right. My point was to find a way to tell the beginners. > A way to stress upon the fact that functions are values like any other > (in Ocaml, at the very least). > > I see some difficulties, thought : > > First, the syntax: > b = fun x -> x+1;; (* b defined as a functionnal value *) > b x = x+1;; (* b defined as a mere function *) > > Second, imperative languages, where b can only be defined as a mere > function. Many courses begin with an imperative language. > > Third, high school, where the only functions we dare name as such are > of type number -> number. Derivation and composition, for instance, > are named "operations", not functions. As if they have anything > special (usefulness excepted). Finally, each function has a name in > high shool mathematics. > > >> Or do you really think that seeing functions as first-class object is >> the natural way ? >> IMHO this is not the case, and therefore not the case of a beginner. > > I agree. I just hope it can become A natural way. > >> To my eyes, there are (I mean, "in human mind" or at least in an >> ocaml beginner's mind) >> values AND functions. A function turns into a value (in the mind of >> the programmer) >> only when it is used by a higher order function. > > I think there are some other uses, too : data structures can contain > closures for instance. A lazily evaluated value is a function (a > closure). > > >>> Did your students used map and fold-like functions much? These >>> almost >>> require anonymous functions. >> >> Indeed, using map and fold puts the focus on the fact that functions >> _can_ be values. >> Thus their importance in a pedagogical context. > > Not only : most loops in a list or an array can be expressed as a > combination of map and fold (and filter, and...). Using these > significantly reduce the amount of code. > >> Maybe all this is just a matter of belief... > > I am quite a zeelot of abstraction. :) > > Regards, > Loup All agreed ! Regards, Vincent