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.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 17FBCBC0A for ; Wed, 23 May 2007 15:21:58 +0200 (CEST) Received: from ag-out-0708.google.com (ag-out-0708.google.com [72.14.246.249]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4NDLvpM019032 for ; Wed, 23 May 2007 15:21:57 +0200 Received: by ag-out-0708.google.com with SMTP id 35so97464aga for ; Wed, 23 May 2007 06:21:55 -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=MdvlkqWbvXj8UxfdrIQr/Z9uUWoa5l4GO9mdNcYKeh7pF6jlZLYU+bw/OzYaBwQQntSq/zPBa+/4+47dCyhlJ79OvDwS5evl2ZG9RzuckBM5aiTb3H2Zt143o1EpSDjV/XOLxPBN44wo5JKKxN9LhAGZWWd/jzaQO85S43Zbj2A= 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=NuqQGGyxxr2HCypNNYNmsxeDw2eAgFAzj/CzGpC7+zrdEhYcbZmXI3WKQqbtwX7keXtiG20zXmIPQkuZa30hPe4tWXBbEdKfpas3D/oKCbKzDqC7Fm/Gga/1uiMXF2VmKlIPhhykFnnFPS1qwQtbJAKWyw16jZ0hoCaS0rxLL1k= Received: by 10.100.253.12 with SMTP id a12mr362955ani.1179926515837; Wed, 23 May 2007 06:21:55 -0700 (PDT) Received: by 10.100.168.16 with HTTP; Wed, 23 May 2007 06:21:55 -0700 (PDT) Message-ID: <6f9f8f4a0705230621y1e830cf4l3cf2e63e4a519870@mail.gmail.com> Date: Wed, 23 May 2007 15:21:55 +0200 From: "Loup Vaillant" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Re: Teaching bottomline, part 3: what should improve. In-Reply-To: <3A6A724D-68A1-4D21-8EF8-7B39F64110E6@yahoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070523100002.6B193BC73@yquem.inria.fr> <3A6A724D-68A1-4D21-8EF8-7B39F64110E6@yahoo.fr> X-j-chkmail-Score: MSGID : 46543FF5.004 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46543FF5.004 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 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