[DGD] Re: Code from Heaven...

Par Winzell zell at alyx.com
Mon Nov 10 10:51:09 CET 1997


Bing,

> As usual i'm asking myself why programmers tend to dothings the
> difficult way. Dworkins function looks much easier to me.

This is too simplistic. There is nothing very magical about lambda, it
is a very general way of creating procedures. Functional languages, like
LISP, that tend to mingle their data and functions more freely than eg C
does, are based on such procedure-creating concepts.

Being able to construct executable code on the fly and pass it around as
if it were data, is a very powerful concept that should not be under-
estimated. It tends to encourage a different programming style from the
very imperative languages, but even in LPC I often find myself wishing
for them.

As an example, we often find ourselves needing to do something like

   filter_array(users(), "is_mighty", this_object())
...
   is is_mighty(object user) { return user->query_property("MIGHTY"); }


For somebody who's ever worked with a functional language, the urge to
be able to write here instead something along the lines of

   filter_array(users(),
                (lambda (user) user->query_property("MIGHTY"))

is overpowering. This is a trivial example -- there are much more
complex and intricate ones. When objects are able to hand out packets of
code as return values to callers, it can really change your world-view.

Unfortunately the syntax of LPC closures is so ugly that it makes the
most well-structured source code look like a recently kicked ant-hill.

That, however, doesn't mean that basing your code on them means you're
doing things "the difficult way".


> Btw anyone knows a url to some info on these things?

On functional languages and/or lambda calculus? Your university should
have a course on it. The traditional Scheme book is SICP, Structure and
Interpretation of Computer Programs, by Abel and Sussman of MIT. Taking
a course based on this book is one of life's true pleasures.



List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list