473,775 Members | 2,523 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 28723
Jon Harrop <jo*@ffconsulta ncy.comwrites:
# cond 2
[( = ) 1, "one";
( = ) 2, "two";
( = ) 3, "three"]
"neither one, two nor three";;
- : string = "two"
I'm missing something. Doesn't Ocaml have strict evaluation? That
means if you use function calls instead of string constants in those
values, they all get called. You haven't really done what cond does.
Dec 10 '06 #281
George Sakkis schrieb:
Well, for one thing we never held the first place anyway. Second, what
appears to be the big boost for Ruby today maybe its death sentence
tomorrow, ending up as a niche language for web apps, like PHP today.
With a large crowd undoubtly, but I bet most Pythonistas would prefer
lower popularity than ending up in a corner of the application
spectrum.
Who really wants to write web apps? Web apps are just an excuse for
Pythonistas to write web frameworks.

Dec 10 '06 #282
Jon Harrop <jo*@ffconsulta ncy.comwrites:
Nothing stops you from re-using the same internal function name in
your Python code, like you might use "i" as a throwaway loop index in
several places in the same function. It's just like in Scheme...

It is not "just like in Scheme" if you don't have anonymous functions in
Python.
Python has anonymous functions (what they can do is somewhat limited
by syntax) but the similarity mentioned with Scheme was about the data
objects. Anyway you don't need to pollute the namespace with lots of
(i.e. more than one) different temporary function name even if you use
non-anonymous functions.
Dec 10 '06 #283
"Kay Schluehr" <ka**********@g mx.netwrites:
A few months ago, I missed the Condition System most
when using Python, and also lexical scope. However, it is nice to work
with friends, who know Python and not Lisp.)

Could you explain in which way Python lacks lexical scoping?
Python has lexical scope but you can't update lexical variables from
scopes other than the innermost or outermost (global) scope. I.e:

def counter():
x = 0
def g():
x += 1
return x
return g

c = counter()
print c()

doesn't do what you'd hope. Yes there are workarounds but they're not
all that satisfactory.
Dec 10 '06 #284
"Wolfram Fenske" <in***@gmx.netw rites:
Yes, I wrote about it in another post. It was introduced in Python
2.5. And if it hadn't been I'd still have to write code like this.
You could do something with decorators that's not too bad. You'd end
up writing:

@withConnection
def some_func():
do_whatever_stu ff ()
Dec 10 '06 #285
Jon Harrop <jo*@ffconsulta ncy.comwrites:
I discovered this recently with F#. Although F# (as a dialect of OCaml) is
impure like Lisp, it does make purely functional programming easy and
provides many purely functional data structures. I translated 15kLOC of
mostly-functional OCaml code into F# and only had to add four locks to make
the whole library concurrent.
The idea of the composable-STM stuff is to not add locks at all, just
mark sections as atomic and the right stuff happens automagically
(i.e. you never have to worry about deadlock), including when you nest
such sections. Its performance also exceeds traditional locking. But
it relies on Haskell's purity.
Dec 10 '06 #286
Paul Rubin wrote:
Jon Harrop <jo*@ffconsulta ncy.comwrites:
># cond 2
[( = ) 1, "one";
( = ) 2, "two";
( = ) 3, "three"]
"neither one, two nor three";;
- : string = "two"

I'm missing something. Doesn't Ocaml have strict evaluation?
Yes.
That means if you use function calls instead of string constants in those
values, they all get called.
True.
You haven't really done what cond does.
Good point. How about this:

# let rec cond x rules default = match rules with
| [] -default
| f :: t -match f x with
| Some e -e
| None -cond x t default;;
val cond : 'a -('a -'b option) list -'b -'b = <fun>

# cond 2
[(fun n -if n=1 then Some "one" else None);
(fun n -if n=2 then Some "two" else None);
(fun n -if n=3 then Some "three" else None)]
"neither one, two nor three";;
- : string = "two"

The 'Some "one"' is only called if its predicate matched. Anyway, you don't
need macros to write COND and you don't need COND if you have pattern
matching.

--
Dr Jon D Harrop, Flying Frog Consultancy
Objective CAML for Scientists
http://www.ffconsultancy.com/product...ex.html?usenet
Dec 10 '06 #287
Paul Rubin wrote:
Jon Harrop <jo*@ffconsulta ncy.comwrites:
>I discovered this recently with F#. Although F# (as a dialect of OCaml)
is impure like Lisp, it does make purely functional programming easy and
provides many purely functional data structures. I translated 15kLOC of
mostly-functional OCaml code into F# and only had to add four locks to
make the whole library concurrent.

The idea of the composable-STM stuff is to not add locks at all, just
mark sections as atomic and the right stuff happens automagically
(i.e. you never have to worry about deadlock), including when you nest
such sections. Its performance also exceeds traditional locking. But
it relies on Haskell's purity.
Yes. My point is that I only had to add four locks in 15kLOC of F# code
because my code was almost entirely pure. So F# is a long way towards that
Haskell ideal whilst having many other advantages over Haskell, like
predictable memory usage.

--
Dr Jon D Harrop, Flying Frog Consultancy
Objective CAML for Scientists
http://www.ffconsultancy.com/product...ex.html?usenet
Dec 10 '06 #288
(message (Hello 'Paul)
(you :wrote :on '(10 Dec 2006 00:01:34 -0800))
(

PRI'm not persuaded, I haven't examined his example carefully yet but it
PRlooks like basically a reader hack. Lexical scope in Lisp means among
PRother things lexical closures and (maybe I'm mistaken) it seemed to me
PRAlex's example didn't supply that.

lexical scope is pretty low-level concept that affects lot of stuff, so it
requires lot of changes -- we are not extending a language, but build a new
one actually.
we'll have to create object 'lexical environment' and to query it for
variable values instead of just using variable values: var -(query env
'var).
then, we'll need to make closures -- that is a pair of environment and code
itself.
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.
that's the point -- macros allow to implement a language with aprox. same
syntax but different semantics relatively easily.

PR I'm also unconvinced (so far) of his description of call/cc as a Lisp
PRmacro but that's going to take me some head scratching.

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."

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"People who lust for the Feel of keys on their fingertips (c) Inity")
Dec 10 '06 #289
Jon Harrop <jo*@ffconsulta ncy.comwrites:
Yes. My point is that I only had to add four locks in 15kLOC of F# code
because my code was almost entirely pure.
But that's like saying you only had to call malloc in 4 different
places, which means dealing with freeing, buffer overruns, etc. As
soon as you use any locks at all, you're susceptable to all the
headaches of dealing with locks. Anyway this is turning into
ML vs. Haskell, maybe an improvement on Lisp vs. Python but still OT.
So F# is a long way towards that Haskell ideal whilst having many
other advantages over Haskell, like predictable memory usage.
F# is pretty similar to ML, right? Hmm. Haskell's memory usage
issues stem more from laziness than purity. One could imagine a
strict Haskell dialect that was still pure (I think ML is heading
in that direction) but that would throw out a lot of Haskell coolness.

Does OCaml support parallel threads at all? I mean using multiple
cpu's simultaneously. I thought it didn't and this was one of the
factors that got me to make the leap into Haskell.
Dec 10 '06 #290

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

Similar topics

14
2188
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
9622
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
9454
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
10107
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...
0
8939
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
5360
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...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4017
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
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2853
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.