473,804 Members | 3,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Lambda: the Ultimate Design Flaw

Shriram Krishnamurthi has just announced the following elsewhere; it might
be of interest to c.l.s, c.l.f, and c.l.p:
http://list.cs.brown.edu/pipermail/p...il/008382.html
The Fate Of LAMBDA in PLT Scheme v300
or
Lambda the Ultimate Design Flaw

About 30 years ago, Scheme had FILTER and MAP courtesy of Lisp hackers
who missed them from their past experience. To this collection,
Scheme added a lexically-scoped, properly-functioning LAMBDA. But,
despite of the PR value of anything with Guy Steele's name associated
with it, we think these features should be cut from PLT Scheme v300.

We think dropping FILTER and MAP is pretty uncontroversial ; (filter P
S) is almost always written clearer as a DO loop (plus the LAMBDA is
slower than the loop). Even more so for (map F S). In all cases,
writing the equivalent imperative program is clearly beneficial.

Why drop LAMBDA? Most Scheme users are unfamiliar with Alonzo Church
(indeed, they don't even know that he was related to Guy Steele), so
the name is confusing; also, there is a widespread misunderstandin g
that LAMBDA can do things that a nested function can't -- we still
recall Dan Friedman's Aha! after we showed him that there was no
difference! (However, he appears to have since lapsed in his ways.)
Even with a better name, we think having the two choices side-by-side
just requires programmers to think about their program; not having the
choice streamlines the thought process, and Scheme is designed from
the ground up to, as much as possible, keep programmers from thinking
at all.

So now FOLD. This is actually the one we've always hated most,
because, apart from a few examples involving + or *, almost every time
we see a FOLD call with a non-trivial function argument, we have to
grab pen and paper and imagine the *result* of a function flowing back
in as the *argument* to a function. Plus, there are *more* arguments
coming in on the side! This is all absurdly complicated. Because
almost all the examples of FOLD we found in practice could be written
as a simple loop with an accumulator, this style should be preferred,
perhaps with us providing a simple helper function to abstract away
the boilerplate code. At any rate, FOLD must fold.

--The PLT Scheme Team
Jul 18 '05
47 2747
Ville Vainio wrote:
Boring code is code that numbs your senses with constant flow of
boilerplate crap, memory management and redundant type declarations
and general blah blah that you skip when you are trying to figure out
what a piece of code does.
The python code I've read so far has looked like that. Not type
declarations, but loooong class declarations.

Also, Guido recently urged people to explicitly write recursions rather
than to use reduce - which I thought was completely in line with what
I've seen as python's goals: readability/understandabili ty as more
important than terseness/non-boringness.
It's a code that you wish you could train a
monkey to write for you while you go for lunch. Think C++ or Java.


Oh, yes. C++ and Java can be super boring. C++ can also be pretty hard
to understand - it's not all boilerplate.

I'm not saying Python is always boring (maybe I've just been in an
easily bored mood when I've read Python stuff), and I'm not saying that
boring is always bad.

Yesterday, I read some marketing prop describing a proprietary IDE
(don't remember what language) as "exciting", and I went "Ugh, no
thanks! Give me calm computing." And then I thought - wait: I just
ranted about boringness on comp.lang.pytho n. Can't boring and calm
sometimes mean the same thing?
Jul 18 '05 #41
>>>>> "Sunnan" == Sunnan <su****@handgra nat.org> writes:

Sunnan> Ville Vainio wrote:

Sunnan> Also, Guido recently urged people to explicitly write
Sunnan> recursions rather than to use reduce - which I thought was
Sunnan> completely in line with what I've seen as python's goals:
Sunnan> readability/understandabili ty as more important than
Sunnan> terseness/non-boringness.

The problem w/ reduce is that it's not intuitive. You'll have to stop
to think what the code w/ reduce does - effectively converting it to a
normal loop (not recursion!) in your head. It's a net loss when you
compare it to just reading an explicit loop as written in code.

Sunnan> Yesterday, I read some marketing prop describing a
Sunnan> proprietary IDE (don't remember what language) as
Sunnan> "exciting", and I went "Ugh, no thanks! Give me calm
Sunnan> computing." And then I thought - wait: I just ranted about
Sunnan> boringness on comp.lang.pytho n. Can't boring and calm
Sunnan> sometimes mean the same thing?

Not for me at least. 'Boring' implies a certain sense of frustration,
not getting anywhere and generally feeling like you are wasting your
time. Human attention is a limited resource, and being bored leads to
loss of attention.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #42
Sunnan:
The python code I've read so far has looked like that. Not > type

declarations, but loooong class declarations.

What do you mean? Lots of repetitive
"self.variable= variable" in the __init__ method? Use of classes when
you would use closures? Or maybe you
are comparing with CLOS classes, which are pretty
slim, since the (multi)methods are defined outside
them?

Michele Simionato

Jul 18 '05 #43
[Aahz]
[François]
Many of us are using Python today, week after week, year long. So
let's be pragmatic. Python is what it became and now is. Let's not
define it as a memory from the past nor as a futuristic dream.

You're free to continue using 1.5.2. [...]


Sure, of course. Yet, our friendly argument is sliding away from was it
originally was. The point was about not asserting in this forum that
Python "has only one way to do it", because this is not true anymore.

The principle has been, it may be back in some distant future, but now
it is not.

--
François Pinard http://pinard.progiciels-bpi.ca
Jul 18 '05 #44
Aahz wrote:
You just can't have your cake and eat it, too.


I've always wondered about this turn of phrase. I seldom
eat a cake at one sitting.

-Scott David Daniels
Sc***********@A cm.Org
Jul 18 '05 #45
On Apr 6, 2005 4:42 PM, Scott David Daniels <Sc***********@ acm.org> wrote:
I've always wondered about this turn of phrase. I seldom
eat a cake at one sitting.


Clearly you're just not trying. ;-)

--
Cheers,
Simon B,
si***@brunningo nline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '05 #46
Sunnan wrote:
Aahz wrote:

(snip)
print "foo is", foo

Is the space added automatically? (Like awk does, if you add a comma.)


Yes. But you can also format it how you like:
print "foo is %s and that's a good news, my friends" % foo

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom. gro'.split('@')])"
Jul 18 '05 #47
Simon Brunning <si************ @gmail.com> writes:
On Apr 6, 2005 4:42 PM, Scott David Daniels <Sc***********@ acm.org> wrote:
I've always wondered about this turn of phrase. I seldom
eat a cake at one sitting.


Clearly you're just not trying. ;-)


:-)))
John

Jul 18 '05 #48

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1455
by: Chas Emerick | last post by:
In a comment off a post on lambda-the-ultimate, I noticed this little offhand remark: '''IIRC GvR is going to kill the various lambda, map,filter & reduce leaving just generator expressions/list comprehension.''' If this is considered generally true (at least in the straight-from-the-rumor-mill sense) I'm hoping someone here can either provide the backstory on this or point me in the direction of related discussions on python-dev...
53
3708
by: Oliver Fromme | last post by:
Hi, I'm trying to write a Python function that parses an expression and builds a function tree from it (recursively). During parsing, lambda functions for the the terms and sub-expressions are constructed on the fly. Now my problem is lazy evaluation. Or at least I think it is. :-)
63
3426
by: Stephen Thorne | last post by:
Hi guys, I'm a little worried about the expected disappearance of lambda in python3000. I've had my brain badly broken by functional programming in the past, and I would hate to see things suddenly become harder than they need to be. An example of what I mean is a quick script I wrote for doing certain actions based on a regexp, which I will simlify in this instance to make the pertanant points more relevent.
26
3509
by: Steven Bethard | last post by:
I thought it might be useful to put the recent lambda threads into perspective a bit. I was wondering what lambda gets used for in "real" code, so I grepped my Python Lib directory. Here are some of the ones I looked, classified by how I would rewrite them (if I could): * Rewritable as def statements (<name> = lambda <args>: <expr> usage) These are lambdas used when a lambda wasn't needed -- an anonymous function was created with...
17
2007
by: mehmetmutigozel | last post by:
I was thinking about something like the following; >>> a= Traceback (most recent call last): File "<stdin>", line 1, in ? NameError: name 't' is not defined >>> or
10
2253
by: ma740988 | last post by:
I'm hoping my post here doesn't fall into the 'hard to say' category, nonetheless I've been advised that multiple uses of accessor/mutator (get/set) member functions can be viewed as a 'design flaw'. In that regard I'm trying to create an 'example' class that's an alternative to the accessor/mutator approach. To further describe the problem consider the class BAR (below) which has a member data in_use that FOO needs visibility into. ...
267
10869
by: Xah Lee | last post by:
Python, Lambda, and Guido van Rossum Xah Lee, 2006-05-05 In this post, i'd like to deconstruct one of Guido's recent blog about lambda in Python. In Guido's blog written in 2006-02-10 at http://www.artima.com/weblogs/viewpost.jsp?thread=147358
23
5340
by: Kaz Kylheku | last post by:
I've been reading the recent cross-posted flamewar, and read Guido's article where he posits that embedding multi-line lambdas in expressions is an unsolvable puzzle. So for the last 15 minutes I applied myself to this problem and come up with this off-the-wall proposal for you people. Perhaps this idea has been proposed before, I don't know. The solutions I have seen all assume that the lambda must be completely inlined within the...
26
2736
by: brenocon | last post by:
Hi all -- Compared to the Python I know and love, Ruby isn't quite the same. However, it has at least one terrific feature: "blocks". Whereas in Python a "block" is just several lines of locally-scoped-together code, in Ruby a "block" defines a closure (anonymous function). To avoid confusion let's call them Ruby block-closures. I see them as just a syntax for defining
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.