Express What, not How.
Hartmann Schaffer
hs at heaven.nirvananet
Wed Oct 15 23:19:39 EDT 2003
In article <raffaelcavallaro-D3CEF4.18102214102003 at netnews.attbi.com>,
Raffael Cavallaro <raffaelcavallaro at junk.mail.me.not.mac.com> writes:
>> A programmer accustomed to the
>> functional style finds the need in non-FP languages to name every
>> function analogously awkward.
>
> No one is talking about need, but about clarity of exposition.
which is essentially a style question, which usually don't have
absolute answers
> It is perfectly possible to program functionally in lisp, as I'm sure
> you know. It just makes code less readable to use _anonymous_ functions.
> Code is no less functional when the functions are named.
this would largely depend on the function. e.g. i don't see any
benefit in adding function definitions to add 2 or multiply by 3
instead of using anonymous functions
(defun add2 (x) (+ x 2))
... many lines / pages/ screenloads of code
(map 'list #'add2 list)
doesn't look any more expositive to me than
(map 'list (lambda (x) (+ x 2)) list),
quite to the contrary. there are enough cases where you need
something like this. obviously, you can abuse this
> ...
> Anonymous functions force the _how_ to be interleaved with the _what_,
> breaking up the clarity of the _what_. Named functions (and macros)
> allow the high level abstractions to be expressed in terms of _what_ is
> happening, without unnecessary reference to _how_.
>
> Anonymous functions force the reader to deal with _how_ precisely
> because there is no descriptive name that expresses _what_ the funtion
> does. This is an inappropriate conflation of two distinct purposes, that
> can and should be separated in source code.
the problem with your position is that you make a dogma out of a
generally useful observation
hs
--
ceterum censeo SCO esse delendam
More information about the Python-list
mailing list