Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Vincent Aravantinos <vincent.aravantinos@yahoo.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: Re: Teaching bottomline,	part 3: what 	should improve.
Date: Wed, 23 May 2007 16:04:54 +0200	[thread overview]
Message-ID: <7CCAC698-FAB7-4F38-8EC3-6ED142DFE321@yahoo.fr> (raw)
In-Reply-To: <20070523132200.F3857BC82@yquem.inria.fr>

> Date: Wed, 23 May 2007 15:21:55 +0200
> From: "Loup Vaillant" <loup.vaillant@gmail.com>
> Subject: Re: [Caml-list] Re: Re: Teaching bottomline,	part 3: what
> 	should improve.
>
> 2007/5/23, Vincent Aravantinos <vincent.aravantinos@yahoo.fr>:
>> 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


       reply	other threads:[~2007-05-23 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070523132200.F3857BC82@yquem.inria.fr>
2007-05-23 14:04 ` Vincent Aravantinos [this message]
     [not found] <20070523100002.6B193BC73@yquem.inria.fr>
2007-05-23 11:00 ` Vincent Aravantinos
2007-05-23 13:21   ` [Caml-list] " Loup Vaillant
2007-05-23 17:05   ` Pal-Kristian Engstad
2007-05-23 17:16     ` Pal-Kristian Engstad
2007-05-23 17:57     ` Robert C Fischer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7CCAC698-FAB7-4F38-8EC3-6ED142DFE321@yahoo.fr \
    --to=vincent.aravantinos@yahoo.fr \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox