473,800 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

merits of Lisp vs Python

How do you compare Python to Lisp? What specific advantages do you
think that one has over the other?

Note I'm not a Python person and I have no axes to grind here. This is
just a question for my general education.

Mark

Dec 8 '06
852 28774
On Sun, 10 Dec 2006 14:35:07 +0000, Kirk Sluder wrote:
In article
<pa************ *************** *@REMOVE.THIS.c ybersource.com. au>,
Steven D'Aprano <st***@REMOVE.T HIS.cybersource .com.auwrote:
>And here I was thinking that languages fell from the sky like donuts!
Gosh, thank you for explaining that too me. What a fool I must seem!

Certainly that is what you wrote. If you had not meant that English
enforces restrictions on expressiveness, perhaps you should not have
written it.
Okay, I'm trying to meet a common ground here, but you're not making it
easy. Of course English, like all languages, restricts what can be said in
that language. I'm talking about grammar and syntax, not semantics, just
like I said at the beginning.

I don't expect that there are concepts that can't be expressed in English
(although some linguists disagree -- see the Sapir-Whorf hypothesis). But
there are many restrictions on *how* we express things. That means that
some concepts can't be expressed as briefly and succinctly in English as
in other languages (and, naturally, vice versa).

Oh, you might also like to look up what a straw-man argument is before
continuing to accuse people of making it. There seems to be this myth on
the Internet and Usenet that a straw-man argument is "any argument I don't
like, or don't understand, or can't refute".

If we both agree that the rules of languages are social, then we
should both agree that in the case of programming language,
communities of language users help to constrain how the language is
used by rejecting extensions that are not lispy/pythonic, and
accepting extensions that converge with accepted style.
That might be true in the case of public code which is open to the entire
community, but it isn't true of all code. Not all code is open to the
wider programmer community to inspect. Code gets written in small teams,
or by individuals, and then it gets used by potentially millions of people
who never got to review the code but have to suffer the consequences of
any bugs in it.

(I'm not saying this is uniquely a problem caused by Lisp macros. Don't
misinterpret what I'm saying.)
--
Steven.

Dec 10 '06 #321


ph************* @gmail.com wrote:
On Dec 10, 12:28 am, a...@pythoncraf t.com (Aahz) wrote:

>>And that is why I will never write Lisp. I loathe Emacs.


Me too. So if that's what's stopping you then you might be interested
to hear that when I moved my free time programming from Python to Lisp
it took only a weekend to learn enough of the language to code up a
little Lisp editor. It's funny that I was able to do this given what
I've now learned from this thread:

- Lisp is only used for research (but I'm not an academic)
- Lisp is hard to learn (because of all those parenthesis)
- There's no practical libraries available (so how did I do it so
fast?)
Our working hypothesis is "mutant strain". We'll need some DNA.

ken

--
Algebra: http://www.tilton-technology.com/LispNycAlgebra1.htm

"Well, I've wrestled with reality for thirty-five
years, Doctor, and I'm happy to state I finally
won out over it." -- Elwood P. Dowd

"I'll say I'm losing my grip, and it feels terrific."
-- Smiling husband to scowling wife, New Yorker cartoon
Dec 10 '06 #322
Paddy wrote:
Python is fun to use.
Easy to read.
Simple and powerful.
Easy to test.
Easy to maintain.
Fast. Very fast!
Okay, I'm going to commit another rhetorical fallacy here called
"Argument from Authority": I challenge anyone making psychological
claims about language X (for any X) being easier to either
read/learn/use than language Y (for any Y) to come up with any valid
evidence whatever. Having a PhD in Cognitive Psychology (as well as two
degrees in computer science) where my subject was how people learn to
program (among other things), and having extensive experience in this
field, I am almost certain that no such evidence exists (at least not
for any real programming language). Now, like any good scientist, I
could be wrong, but you'd have to convince me, and I very much doubt
that you could.

While I'm engaging in this particular fallacy, here's another instance:
Since I'm probably (although I'm not certain) the only person in this
thread who has made a significant amount of money on either of these
languages (i.e., via the sale of a startup whose product was tens of
thousands of lines of Lisp code, and some Tk GUI stuff), and knowing
both Lisp and Python (although I'm certainly not a Python wizard), I am
nearly certain that what we did in Lisp COULD NOT HAVE BEEN DONE IN
PYTHON -- PERIOD. The reason has little to do with macros (although
they were very helpful, of course, esp. in making Tcl look like a
reasonable language so that we could use Tk); it has to do with speed,
which has to do with compilers, which, as it turns out, has to do with
macros. (See below.)

Now, speaking as a scientist, permit me to make a small practical
suggestion: Why not just figure out a way to simplify some brand of
Python -- make parens (or whatever) optionally replace whitespace and
line breaks as syntax -- and then add a simple macro facility -- macros
are actually a very simple extension if you have homogenous syntax,
homogenizing your syntax to the point where macros are possible is the
hard part -- and just see what happens. One of two general things are
likely to happen: Either people will not use them, and they will
languish and die, and then at least you can say; "Been there, done
that" to the Lisp community. Or, more likely, the some subset of the
Python community will get it, and will figure out how useful they are,
although it might take some time. And then you might find yourself with
a wonderful new tool. You might even get a compiler out of the deal, at
a pretty low cost, too! If you get macros, and get a compiler, I'm
pretty sure that you will have no problem winning over the Lisp
community, who would LOVE to have your extensive libraries, and that
you will probably be able to maintain and improve your flagging
position wrt Ruby (which, according to Matz, is more-or-less just Lisp
w/o macros.)

I'm not saying that this is going to be an easy or quick experiment,
but it's one that I, and I think most Lispers, would both like to see
happen, and would benefit from! Moreover, I dare say that some of us in
the Lisp community would love to HELP -- at least I would, and I'm
guessing that others would as well.

(Unless you guys get a compiler too, you'll always just be a
scripting language, but compilers are GREATLY facilitated by having a
macro facility because (at first blush) all you need to do is to
macro-expand down to something you know how to turn into code. This
isn't the only, nor perhaps the best way to get a compiler, but it's
a step in that direction. Later on you can learn the other great
features offered by homogeneous syntax, like being able to write code
walkers, which help improve over the "first blush" compiler. Soon
enough, I predict, you'll be so far past us and Ruby that...well,
even Kenny with jump on board! :-)

Dec 10 '06 #323
On Sun, 10 Dec 2006 08:51:44 -0800, JS******@gmail. com wrote:
Since I'm probably (although I'm not certain) the only person in this
thread who has made a significant amount of money on either of these
languages (i.e., via the sale of a startup whose product was tens of
thousands of lines of Lisp code
Care to tell us what the startup was, and where it is now?
--
Steven.

Dec 10 '06 #324
On Mon, 11 Dec 2006 02:51:50 +1100, Steven D'Aprano wrote:
On Sun, 10 Dec 2006 14:21:17 +0000, Kirk Sluder wrote:
>In article
<pa*********** *************** **@REMOVE.THIS. cybersource.com .au>,
Steven D'Aprano <st***@REMOVE.T HIS.cybersource .com.auwrote:
>>Yes. But you can't redefine 1+2 in Python, at least not without hacking
the interpreter. Can you redefine (+ 1 2) in Lisp?

Not without barreling through error messages about name conflicts.

Ah, nice to get a straight answer to a question for a change, and without
an insult or a misrepresentati on in sight. Thank you.
Such a pity that answer is, apparently, wrong.

Thank you to those who wrote back with the more accurate answer, which
apparently is "yes, it is easy and there are no error messages".

I'd love to say it has been fun, but it has been more frustrating than
enjoyable. I don't mind an honest disagreement between people who
genuinely are trying to see the other's point of view, but I don't think
that was the case here. What was especially frustrating was that the more
I tried to understand certain Lispers' positions by asking questions, the
more nasty and insulting they became. So now I have an even better
understanding for why Lispers have a reputation for being difficult and
arrogant.

(And believe me, I could say a lot more about that, but I'm trying to be
conciliatory, so I'll just shut up now.)

But I also gained a little more insight into why Lispers love their
language. I've learnt that well-written Lisp code isn't as hard to read as
I remembered, so I'd just like to withdraw a comment I made early in the
piece. I no longer believe that Lisp is especially strange compared to
natural languages.

Anyway, real life catches up on me, and so I must drop out of this thread.
May it not last for ever.

--
Steven.

Dec 10 '06 #325
Steven D'Aprano wrote:
On Sun, 10 Dec 2006 15:05:04 +0100, Stefan Nobis wrote:
Ever talked to skateboarders? Other people of different scenes? They
are creating new, specialized languages every day.

Yes, that's right. And if they insist on using their specialist language
where "that's bad" means "that is best quality", and I insist on using
my language where "that's bad" means "that is worst quality", how much
successful communication are we going to have?
Having such a specialist language, which goes against common
practice, would be stupid. There nothing to gain from doing so,
so it's not done.

The same is true for macros. Redefining everything and programming
in your own special way just to be different would be stupid, and
it's not done.
Everyone keeps telling you this but you keep ignoring it.

Wonder why.

Macros are used where they must be used, to do things that are not
possible with functions. Functions have benefits that macros don't
have, and for most things (but not all things), those benefits are
more useful than the benefits provided by macros.

I will also note that Ken Tilton was right about analogies, and
far too much of this discussion is now about English language, not
the merits of Lisp vs Python. Sad, because there is some good
stuff in here.

Dec 10 '06 #326
(message (Hello 'Paul)
(you :wrote :on '(10 Dec 2006 04:36:43 -0800))
(

??>so, it's very close to writting new interpreter -- but it's order of
??>magnitude easier to write this interpreter via macros than from
??>scratch, most other language constructs can be reused.

PRBut now you've got an interpreter and you no longer have that Lisp
PRcompiler.

why do you think so?
if you have C compiler that translates C to assembly, and then compiles
assembly to machine language -- that's not C compiler, not asm compiler, or
what?
yes, possibly it would be sub-optimal, but at least it will work. and
normally there would be no big performance penalties.

??>there is a chapter about continuations in Paul Graham's "On Lisp".
??>>
??>"Common Lisp doesn't provide call/cc, but with a little extra effort
??>we can do the same things as we can in Scheme. This section shows how
??>to use macros to build continuations in Common Lisp programs."

PRI think he's mistaken about being able to implement call/cc in full
PRgenerality with CL macros in any reasonable way.

why do you think so?
you know some case that does not work with call/cc?
i was programming quite significant working system with call/cc in Common
Lisp.
and although there were some glitches, it was doing quite well.

PR But it might be possible to implement enough to do something like
PRPython generators using lexical closures that one re-enters through
PRsome kind of cond statement selecting the yield point to be continued
PRfrom.

why are you theoretizing -- i've showed working real example of generators!
just get SBCL and ARNESI, load it, and then use call/cc as i've shown in
example. that's real generators. there's no need for any cond -- you can
save state as current-continuation.
if you don't understand how it works, run macroexpand -- it's quite simple
thing.
you can find full defgenerator code here

http://www.cl-user.net/asp/Mi4$4/sdataQvxM$sStWN jUDQ3t9G8X8yBX8 yBXnMq=/sdataQu3F$sSHnB ==

you can find also other implementations of defgenerator's -- but with
ARNESI's CPS call/cc works with LOOP (that's actually surprising -- since
loop uses TAGBODY/GO -- maybe their code walker mutates TAGBODY making it
functional-style, or something like that).

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"People who lust for the Feel of keys on their fingertips (c) Inity")
Dec 10 '06 #327
Steven D'Aprano <st***@REMOVE.T HIS.cybersource .com.auwrites:
I'd love to say it has been fun, but it has been more frustrating than
enjoyable. I don't mind an honest disagreement between people who
genuinely are trying to see the other's point of view, but I don't think
that was the case here. What was especially frustrating was that the more
I tried to understand certain Lispers' positions by asking questions, the
more nasty and insulting they became. So now I have an even better
Could that be because you were submitting enormous posts making the
same claim and ignoring any new developments several times a day?
But I also gained a little more insight into why Lispers love their
language. I've learnt that well-written Lisp code isn't as hard to read as
I remembered, so I'd just like to withdraw a comment I made early in the
piece. I no longer believe that Lisp is especially strange compared to
natural languages.
Strange that you'd come to that conclusion. I thought we'd
established higher up that most programming languages are not like
natural languages
Dec 10 '06 #328
Steven D'Aprano wrote:
Care to tell us what the startup was, and where it is now?
Sure. We were called Afferent, Inc. We did simulated organic chemistry,
robot planning and control, and semi-automatic products analysis for
combinatorial chemistry for drug discovery for the pharmaceutical
industry. Founded in, um, ~1996? we were acquired in, um, 1999? (sorry,
I'm a little fuzzy on the dates) by MDL, Inc. for ... well, I'm not
sure that I'm supposed to say how much, so I won't. If someone can find
it in the public record, please feel free to post it. Let's just say
that we weren't a Dot Com but we also weren't particularly unhappy
about the deal. :-)

BTW, I didn't mean to imply that only reason that we used Lisp was the
compiler. What we were doing was more-or-less AI, and we wouldn't have
even thought to try to use anything other than Lisp. (I won't say that
we couldn't have in theory done it in another compiled language for
fear of attack by the Turing Mafia! :-) What I meant was the we
certainly would not have even consider Python or any other uncompiled
language because it would have been WAY too slow! Our (delivered
executable!) product could do hundreds of thousands of simulated
chemical reactions and solve robot planning problems in seconds. (The
robot planning was actually pretty simple. The simulated chemistry was
decidedly NOT!) The Tk-based GUI was by far the slowest part of the
system!

I have the code here (probably not the latest bcs I left the company
when it was acquired), let's do a little experiment, for what it's
worth: 89727 lines of Lisp code in 131 modules (lisp code files), 3306
"(defun" (by grep|wc), and 261 "(defmacro" . [We did NOT use
macros as functions!] [Note that lines of code doesn't really matter
in Lisp.]

If you are interested, you can read a little about our product in this
paper:
http://nostoc.stanford.edu/jeff/pers...forscience.pdf

as well as seeing a little of the interface. (If you have any interest
in history of science, EScience, or drug discovery, you might even find
the content of the paper interesting! :-)

Dec 10 '06 #329
"Alex Mizrahi" <ud******@users .sourceforge.ne twrites:
PRBut now you've got an interpreter and you no longer have that Lisp
PRcompiler.

why do you think so?
if you have C compiler that translates C to assembly, and then compiles
assembly to machine language -- that's not C compiler, not asm compiler, or
what?
yes, possibly it would be sub-optimal, but at least it will work. and
normally there would be no big performance penalties.
There would be terrible performance penalties dealing with the
environment lookup on every lexical variable reference. That's the
point. The compiler would treat those as references to slots in the
call frame, would do type inference so it could use unboxed atoms
where it could, etc. You'd lose all that.
PRI think he's mistaken about being able to implement call/cc in full
PRgenerality with CL macros in any reasonable way.

why do you think so?
you know some case that does not work with call/cc?
I don't see how to implement coroutines with CL macros. Maybe I'm
missing something.
why are you theoretizing -- i've showed working real example of generators!
just get SBCL and ARNESI, load it,
Too much hassle, I haven't used CL in many years and can't see doing
the big download etc. just to try out one example. It's not like I'm
going to suddenly discover the delights of CL. Been there, done that.
I might re-read the LTU papers to see if I'm missing something about
how CPS works. I've always been hazy on that stuff.
and then use call/cc as i've shown in
example. that's real generators. there's no need for any cond -- you can
save state as current-continuation.
Fully general call/cc has to be able to switch from one execution
stack to another and back. However, that is not needed for Python
generators ("simple generators"), which can only yield to their direct
caller. I think you might be able to do simple generators with messy
macros but I don't see how you can do call/cc, jumping out to the
continuation across many levels of function calls and then returning
back into all those calls. The contination is not just a machine
address or environment, it carries a lot of other state.
Dec 10 '06 #330

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

Similar topics

14
2194
by: Paddy3118 | last post by:
This month there was/is a 1000+ long thread called: "merits of Lisp vs Python" In comp.lang.lisp. If you followed even parts of the thread, AND previously used only one of the languages AND (and this is the crucial bit), were persuaded to have a more positive view of the other language; (deep breath, this is a long, as well as grammatically incorrect sentence), THEN WHY NOT POST ON WHAT ARGUMENTS PERSUADED YOU.
0
9690
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
9551
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
10505
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
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
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
5471
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...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
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.