merits of Lisp vs Python

J

jayessay

Kaz Kylheku said:
Actually, that is false. You can have any syntax you like in Common
Lisp. For instance, the syntax of Python:

http://trac.common-lisp.net/clpython/

Are you sure that really is _in_ CL? and not "just" an implementation
written in CL? Specifically, can you drop in and out of the python
syntax within a CL function definition (or vice-versa)? It would be
_very_ cool if you could, but (admittedly cursory) looking it over
makes me think not.


/Jon
 
W

Willem Broekema

Paul said:
What would it take to get Python people more interested in it? I've
been monitoring the site [1] and the mailing list [2] for some time,
but nothing particularly visible seems to be happening.

Well, judging from the reactions on blogs to the initial announcement
here, quite some people have heard about it and seem interested. But
that didn't result in more people hacking on it, which is unfortunate.

I guess in part it's because there are not that many people really into
both Python and Lisp, and those who are might not find this an
interesting project because there is nothing "wow" to show, yet.

So you are right about the project silence. Right now it's a one-person
pet project, and progress is slow. But I'm already quite happy about
the current state: stable, usable, and fairly complete.

As for more exposure: I'd prefer to wait with big announcements until
there are really interesting things achieved.

Thanks a lot for your interest and comments!

- Willem
 
M

Mathias Panzenboeck

Bruno said:
Mathias Panzenboeck a écrit :

Python has functions as first-class objects (you can pass functions as
arguments to functions, return functions from functions, and bind
functions to identifiers), and that's the only thing you need to use a
functional approach.

You mean like function pointers in C and C++? I think this should be possible in assembler, too.
I thought functional languages have to be declarative?
The boost C++ library has even lambdas!
 
M

Martin Rydstr|m

Ken Tilton said:
outrage over my condescension and arrogance.]

Your condescension and arrogance are fairly well established, and no
longer cause much outrage, except in extraordinary circumstances.

',mr
 
K

Kaz Kylheku

Bruno said:
André Thieme a écrit :

If you go that way, there are declarative stuff in Python too... But
neither Lisp nor Python are close to, say, SQL.

False. Common Lisp can be made to support SQL syntax.
 
P

Paul Rubin

Rob Thorpe said:
Once you can do the above then you can phrase programs entirely in
terms of composition of functions, which is what functional programming
is about.

Getting good performance though is problematic without being able to
evaluate parts at compile time. This is why almost all functional
languages provide that feature in some form.

I'm not aware of any special features in Haskell for that purpose, or
in Scheme until maybe with the more recent versions. I thought the
main feature needed for functional programming besides first-class
functions was guaranteed tail call optimization.
 
P

Paul Rubin

Willem Broekema said:
I guess in part it's because there are not that many people really into
both Python and Lisp, and those who are might not find this an
interesting project because there is nothing "wow" to show, yet.

I thought it was of some interest though I'm a little surprise by the
choice of CL rather than Scheme as a target.

I'm still not sure about the mapping of Python strings to Lisp strings.
What happens with the following in CLPython?

a = 'hello'
a[0] = 'H' # attempt to change first letter to upper case
 
G

greg

Ken said:
How close can Python get when code is involved? The reverse function
signature is fixed, so can lambda help?

Lambda can be used if the body can be written as a
single expression. Otherwise you need to write the
function as a separate def. When the body is more
than a line or two, this is not usually much of
a problem, and is arguably more readable anyway.
 
B

Bjoern Schliessmann

What it isn't is some kind of miraculous invention that saves
programmers from ever making mistakes that are common in other
languages, or that reduces effort in copy-paste, as Bjoern seemed
to be claiming.

I didn't. I just stated that the Python way is less work for me.

Regards,


Björn
 
B

Bjoern Schliessmann

What it isn't is some kind of miraculous invention that saves
programmers from ever making mistakes that are common in other
languages, or that reduces effort in copy-paste, as Bjoern seemed
to be claiming.

I didn't. I just stated that the Python way is less work for me.

Regards,


Björn

Xpost cll,clp
 
G

Gabriel Genellina

Warning: absolutely off topic!

Well, I spent some time on Wikipedia looking up metric systems and
things like that because of you, and I found a page that shows how to
improve the current SI system by reducing the number of fundamental
units to only two ( S for space and T for time ), and it was a great
read. It even went so far as give a theory for the disapearance of the
dinosaurs!

You can even make S = cT (c=ligth of speed in void space).
The choice of fundamental units is rather arbitrary, and can be
reduced further to only 1 fundamental unit and even NO fundamental units.
There is a nice book about this subject by L. A. Sena: Units of
physical quantities and their dimensions (or similar, I don't have it
at hand to check the title).


--
Gabriel Genellina
Softlab SRL

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
 
X

xscottg

Ken said:
No, not reverse, the part you did not understand. I do not mean what the
code was doing, I meant that it was code.

Code is data is code - even in Python:

skills_table = [
{
"title": "Absolute Value",
"annotations": ["Bleah bleah", "ho hum", "etc..."],
"hints": ["and so on", "etc..."],
"reverse" : (lambda x: whatever(x))
},
{
"title": "Square Root",
"annotations": ["Bleah bleah", "ho hum", "etc..."],
"hints": ["and so on", "etc..."],
"reverse" : (lambda x: someother(x))
},
# etc...
]

Of course those lambdas are crippled in Python (and not really
necessary in this bogus example)... But that's without trying to be
clever:

class AbsoluteValue:
title="Absolute Value"
annotations=["Some list", "goes here"]
@classmethod
def reverse(cls, *args):
# I didn't understand what your code was doing
pass
defskill(AbsoluteValue)

That would be a reasonable place for a "pie decorator" on a class, but
I guess that's not allowed. I doubt this second example would be
considered "Pythonic" in any case...

Not the code. In reverse.

Why not?

Python has plenty of other flaws that I can't happily work around, and
I do think Lisp is more flexible. However, I think your example is
readable enough with a data driven algorithm in most any popular
language. All of the data is visible to the reverse(...) method.
Maybe I missed something in your example, but I think you aren't trying
hard enough. :)

The one I liked was: http://ll1.ai.mit.edu/shriram-talk.pdf

If I ever fill in your RtL survey, I'll be citing that one as a turning
point for me.

Interpolation does not mean what you think it means.

I'm sure he meant "string interpolation", which is a common enough term
in scripting languages nowdays.

It would be easier to compare and
contrast with the Python equivalent if someone had posted such, but your
troops have fallen back to Fort So What? and pulled up the drawbridge.

Oh God! Is it just me out here? And I'm not even a believer.

Cheers.
 
D

David Steuber

Ken Tilton said:
We're shocked.

Don't anyone tell him about LOOP.

--
This post uses 100% post consumer electrons and 100% virgin photons.

At 2.6 miles per minute, you don't really have time to get bored.
--- Pete Roehling on rec.motorcycles

I bump into a lot of veteran riders in my travels.
--- David Hough: Proficient Motorcycling
 
D

David Steuber

Wolfram Fenske said:
Yes, now I can. But I had to wait until Python 2.4 to be able to
that. What I like so much about Lisp macros is that they allow me to
make these changes myself.

Besides, who wants to write production code in a language that keeps
changing? It's enough work just keeping up with new libraries.

--
This post uses 100% post consumer electrons and 100% virgin photons.

At 2.6 miles per minute, you don't really have time to get bored.
--- Pete Roehling on rec.motorcycles

I bump into a lot of veteran riders in my travels.
--- David Hough: Proficient Motorcycling
 
D

David Steuber

Steven D'Aprano said:
How am I being silly? Do you not believe that people write case blocks
with fifty tests? Okay, how about twenty? Ten? Eight?

You should check out generic functions in CLOS. Rather than writing a
ridiculously long case block, you can use EQL specialized functions.
It's a great way to do dispatch.

--
This post uses 100% post consumer electrons and 100% virgin photons.

At 2.6 miles per minute, you don't really have time to get bored.
--- Pete Roehling on rec.motorcycles

I bump into a lot of veteran riders in my travels.
--- David Hough: Proficient Motorcycling
 
G

greg

Gabriel said:
You can even make S = cT (c=ligth of speed in void space).
The choice of fundamental units is rather arbitrary, and can be reduced
further to only 1 fundamental unit and even NO fundamental units.

I once heard mention of a system of units in use at
one time with the odd feature that capacitance came
out in units of length.

Picture the scene: Hobbyist walks into Dick Smith
store and says "I'd like a 5cm capacitor, please."
 
G

greg

Ken said:
So this:
(defmethod tf-reverse (id (eql ',sub-id)) resx (drv-opnds tf drv))
,@reverser)

becomes this:

(defmethod tf-reverse ((id (eql ',sub-id)) tf drv
&aux (opnds (drv-opnds tf drv)))
(loop for resx in (results drv)
,@reverser))

I don't see why you can't just write a function that
loops over the results and calls the user's reversal
function for each one.

def reverse_multiple(skill, resx_list, opnds):
for resx in rex_list:
skill.reverse(resx, opnds)

There's no need to macro-expand this code into every
reversal function, when it can be done once as part of
the framework that calls the reversal functions.
 
G

greg

Ken said:
The reason I post macro expansions along with examples of the macro
being applied is so that one can see what code would have to be written
if I did not have the defskill macro to "write" them for me.

It seems to me your brain is somewhat stuck on the use
of macros. You're looking at the expansion of your
macro and assuming that you'd have to write all that
code by hand if you didn't have macros. You're not
thinking about alternative approaches, which could
just as well be used in Lisp as well as Python, that
are just as compact yet don't make use of macros.

Unless there's something very subtle that I'm missing
(I can't claim to follow exactly what all the code
you posted does in detail) I haven't seen anything
that couldn't be done quite reasonably with an
appropriate data structure and ordinary functions
and methods operating on that data structure.
 
G

greg

I fail to see how it is the same in Python.

Probably what Neil is referring to is the fact that in
Python, *within an expression*, indentation is not relevant.
If you put parens around the whole expression, you can split
it across lines however you like, and indent all the lines
after the first one however you like, and it makes no
difference. You could probably even use your Lisp-aware
auto-indenter on the expression and it would do something
reasonable.

It's only *statement* nesting that's determined by relative
horizontal position (which is a better way of thinking about
it than "whitespace" -- the whitespace is only there to
get things into the right position). And statements normally
occupy one or more entire lines.
How does a manual correction process come out as simple as "don't
bother fixing the indentation if you don't care."?

I think the point is that correcting indentation in Python
is the equivalent of fixing misplaced parentheses in Lisp,
and that they're about equally difficult.
 
G

greg

I wrote my first Python in a non-Python-aware editor, and somehow had
swapped tabs and spaces; when I moved it to IDLE---the indentation
*looked fine* but was invisibly weird.

That can admittedly be a problem. It would help if the
parser complained by default about mixed use of tabs and
spaces in a single file, instead of silently assuming tab
stops every 8 spaces (an historical misfeature that we still
have for the time being). Probably this will change in
Python 3.0.

Personally I find Python pleasant enough to work with
that I'm willing to put up with the odd screwup like that
happening now and then. And they really don't happen all
that often -- once you've experienced it a few times,
you learn how to guard against it and get better at
fixing it when it does happen.
> I will even admit that white-space significance does not
materially increase errors among experienced Pythonistas. What it isn't
is some kind of miraculous invention that saves programmers from ever
making mistakes that are common in other languages,

We don't claim that -- only that it's not the unmitigated
disaster than some people assume it will be without ever
having tried it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top