[plt-scheme] Functions as first class data types.

From: e (eviertel at gmail.com)
Date: Sat Feb 14 23:21:39 EST 2009

wow, based on that link, I guess my answer to the "newbie lambda()(??????)"
post wasn't that unique.  Here's an excerpt that had to do with *why* (not
how) the stop function was tied to the function returned from "server":

"Not only CAN you return a function, the REASON you are in this case is so
that its execution will be tied (bound) to the thread that was started.  I
am thinking this is an example of a "closure".

I guess in OO, you'd make a server "instance", and it would have a "stop"
command . . .. or you could "delete" it (in C++), which would call the
"destructor" . . . or in Java, there's some what of an opportunity in
"finalize()", but not a reliable one.  In Python, I'm thinking you'd have a
"stop", and it'd be obvious that construction and "stopping" aren't
symmetric operations.

Now that I've made this comparison, it seems like the argument you have for
fp reduces from "you can't do this in OO" to, "you need more boilerplate and
fanfare to do it in OO" (possibly a whole file, possibly two -- one for the
header and one for the implementation, RAII semantics on the constructor,

On Sat, Feb 14, 2009 at 10:29 PM, Henk Boom <henk at henk.ca> wrote:

> 2009/2/14 Grant Rettke <grettke at acm.org>:
> > On Sat, Feb 14, 2009 at 6:24 PM, aditya shukla
> > <adityashukla1983 at gmail.com> wrote:
> >> Can someone  please explain what's the use of having functions as first
> >> class data type in scheme .I am a little confused about functions having
> >> functions as their arguments .
> >
> > There are problems that you want to solve while programming where you
> > will find that first class functions are one good solution. In their
> > absence there are other good solutions, too.
> Other good solutions such as objects:
> http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html
>    Henk
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090214/18886b80/attachment.html>

Posted on the users mailing list.