473,554 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python syntax in Lisp and Scheme

I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro capabilities, unfortunately. I'd like to know if it may
be possible to add a powerful macro system to Python, while
keeping its amazing syntax, and if it could be possible to
add Pythonistic syntax to Lisp or Scheme, while keeping all
of the functionality and convenience. If the answer is yes,
would many Python programmers switch to Lisp or Scheme if
they were offered identation-based syntax?
Jul 18 '05
699 33497
"Terry Reedy" <tj*****@udel.e du> writes:
Other Lispers posting here have gone to pains to state that Scheme is
not a dialect of Lisp but a separate Lisp-like language. Could you
give a short listing of the current main differences (S vs. CL)?
According to the "Revised(5) Report on the Algorithmic Language
Scheme", "Scheme is a statically scoped and properly tail-recursive
dialect of the Lisp programming language..." It's certainly not a
dialect of Common Lisp, although it is one of CL's ancestors.

I'm sure if you do some web-groveling, you can find some substantial
comparisons of the two; I personally think they have more in common
than not. Here are a few of the (arguably) notable differences:

Scheme Common Lisp
Philosophy minimalism comprehensivene ss
Namespaces one two (functions, variables)
Continuations yes no
Object system no yes
Exceptions no yes
Macro system syntax-rules defmacro
Implementations >10 ~4
Performance "worse" "better"
Standards IEEE ANSI
Reference name R5RS CLTL2
Reference length 50pp 1029pp
Standard libraries "few" "more"
Support Community Academic Applications writers

The Scheme community has the SRFI process for developing additional
almost-standards. I don't know if the CL community has something
equivalent; I don't think they did a year ago.
If I were to decide to expand my knowledge be exploring the current
versions of one(I've read the original SICP and LISP books), on what
basis might I make a choice?


Try them both, see which one works for you in what you're doing.

Jeremy
Jul 18 '05 #21
Oren Tirosh <or*******@hish ome.net> writes:
Implementing Python-like syntax in LISP or even a full Python
implementation in LISP would be a worthwhile goal (LPython?). BTW, this
kind of implementation is one of the relatively few programming tasks
that can benefit greatly from macros. The Python semantics can be mostly
done using macros and a preprocessor would translated Python syntax to
s-expression code that uses those macros.


If done straightforward ly, the language semantics would end up
different from Python's in a few ways. For example, strings in most
Lisp systems are mutable. Also, Python's class system doesn't map
onto Lisp all that well; Python's variable-scoping rules are bizarre,
and so forth. I think the result would still be worth doing but
it would be a further departure from CPython than, say, Jython is.
Jul 18 '05 #22
jh*****@ai.mit. edu (Jeremy H. Brown) writes:
"Terry Reedy" <tj*****@udel.e du> writes:
Other Lispers posting here have gone to pains to state that Scheme is
not a dialect of Lisp but a separate Lisp-like language. Could you
give a short listing of the current main differences (S vs. CL)?
I'm sure if you do some web-groveling, you can find some substantial
comparisons of the two; I personally think they have more in common
than not. Here are a few of the (arguably) notable differences:
This is actually a pretty good list. I'm not commenting on
completeness, but I do have a couple of corrections:
Scheme Common Lisp
Philosophy minimalism comprehensivene ss
Namespaces one two (functions, variables)
Continuations yes no
Object system no yes
Exceptions no yes
Macro system syntax-rules defmacro
Implementations >10 ~4 =============== =============== =============^

See http://alu.cliki.net/Implementation - it lists 9 commercial
implementations , and 7 opensource implementations . There are
probably more.
Performance "worse" "better"
Standards IEEE ANSI
Reference name R5RS CLTL2 =============== =============== ==============^

No, CLtL2 is definitely _not_ a reference for ANSI Common Lisp.
It was a snapshot taken in the middle of the ANSI process, and
is out of date in several areas. References which are much closer
to the ANSI spec can be found online at

http://www.franz.com/support/documen...icl/ansicl.htm

or

http://www.lispworks.com/reference/H...ront/index.htm
Reference length 50pp 1029pp
Standard libraries "few" "more"
Support Community Academic Applications writers

The Scheme community has the SRFI process for developing additional
almost-standards. I don't know if the CL community has something
equivalent; I don't think they did a year ago.


There are many grassroots defacto standards efforts to extend CL in
several areas. Some of these are listed here:

http://alu.cliki.net/Standard
If I were to decide to expand my knowledge be exploring the current
versions of one(I've read the original SICP and LISP books), on what
basis might I make a choice?


Try them both, see which one works for you in what you're doing.


Agreed, but of course, I'd recommend CL :-)

--
Duane Rettig du***@franz.com Franz Inc. http://www.franz.com/
555 12th St., Suite 1450 http://www.555citycenter.com/
Oakland, Ca. 94607 Phone: (510) 452-2000; Fax: (510) 452-0182
Jul 18 '05 #23
> Object system no yes
To be fair, most Scheme implementations come with one, and you can always
download an external one if you want.
Macro system syntax-rules defmacro Again, depends on the implementation. Gambit offers CL-style macros too.
Performance "worse" "better"

Depends on the implementation. Bigloo did a bit better on the Great Computer
Language Shootout than did CMUCL, though, there were complaints that the
CL-code was sub-par. In the few small benchmarks I've tried on my machine,
Bigloo is pretty competitive with CMUCL.
Jul 18 '05 #24
Duane Rettig <du***@franz.co m> writes:
jh*****@ai.mit. edu (Jeremy H. Brown) writes:
This is actually a pretty good list. I'm not commenting on
completeness, but I do have a couple of corrections:

....
Implementations >10 ~4

=============== =============== =============^

See http://alu.cliki.net/Implementation - it lists 9 commercial
implementations , and 7 opensource implementations . There are
probably more.


Thanks. I hadn't realized the spread was that large.
Performance "worse" "better"
Standards IEEE ANSI
Reference name R5RS CLTL2

=============== =============== ==============^

No, CLtL2 is definitely _not_ a reference for ANSI Common Lisp.
It was a snapshot taken in the middle of the ANSI process, and
is out of date in several areas. References which are much closer
to the ANSI spec can be found online at

http://www.franz.com/support/documen...icl/ansicl.htm

or

http://www.lispworks.com/reference/H...ront/index.htm


Thanks again.

Try them both, see which one works for you in what you're doing.


Agreed, but of course, I'd recommend CL :-)


I've arrived at the conclusion that it depends both on your task/goal
and your personal inclinations.

Jeremy
Jul 18 '05 #25


mi*****@ziplip. com wrote:
I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro capabilities, unfortunately. I'd like to know if it may
be possible to add a powerful macro system to Python, while
keeping its amazing syntax, and if it could be possible to
add Pythonistic syntax to Lisp or Scheme, while keeping all
of the functionality and convenience. If the answer is yes,
would many Python programmers switch to Lisp or Scheme if
they were offered identation-based syntax?


Why do I feel like crying? :{

Cheers
--
Marco
Jul 18 '05 #26
pr***********@c omcast.net writes:
mi*****@ziplip. com writes:
I think everyone who used Python will agree that its syntax is
the best thing going for it.


I've used Python. I don't agree.


I'd be interested to hear your reasons. *If* you take the sharp distinction
that python draws between statements and expressions as a given, then python's
syntax, in particular the choice to use indentation for block structure, seems
to me to be the best choice among what's currently on offer (i.e. I'd claim
that python's syntax is objectively much better than that of the C and Pascal
descendants -- comparisons with smalltalk, prolog or lisp OTOH are an entirely
different matter).

'as
Jul 18 '05 #27


Kenny Tilton wrote:


Kenny Tilton wrote:


Toni Nikkanen wrote:
It's be interesting to know where people got the idea of learning
Scheme/LISP from (apart from compulsory university courses)?


<g> We wonder alike. That's why I started:

http://alu.cliki.net/The%20Road%20to%20Lisp%20Survey

That recently got repotted from another cliki and it's a little
mangled, but until after ILC2003 I am a little too swamped to clean it
up.

Me and my big mouth. Now that I have adevrtised the survey far and wide,
and revisited it and seen up close the storm damage, sh*t, there goes
the morning. :)

OK, I copied over all the twenty-plus pages that got lost in the
repotting, fixed the survey questions, and even took the time to
annotate my Top Ten list:

http://alu.cliki.net/Kenny's%20RtLS% 20Top-Ten

Check it out. The Switch Date pages have been restored, but I do not
think the cross-indexing works until pages get edited and resaved. That
is not the most fascinating breakdown in the world, so it may be a while
before I fuss with that. But this breakdown is cool:

http://alu.cliki.net/The%20RtLS%20by%20Road

More responses always welcome.

kenny

Jul 18 '05 #28

"Jeremy H. Brown" <jh*****@ai.mit .edu> wrote in message
news:uv******** *****@tenebrae. ai.mit.edu...
"Terry Reedy" <tj*****@udel.e du> writes: .....
give a short listing of the current main differences (S vs. CL)?

.... than not. Here are a few of the (arguably) notable differences: ....
Thank you. This is just the sort of preview I wanted.
Try them both, see which one works for you in what you're doing.


My present interest is intellectual broadening. I think I should
start with parts of the current version of SICP and then read a modern
CL chapter on macros.

Terry J. Reedy

Jul 18 '05 #29
Alexander Schmolck <a.********@gmx .net> writes:
pr***********@c omcast.net writes:
mi*****@ziplip. com writes:
> I think everyone who used Python will agree that its syntax is
> the best thing going for it.


I've used Python. I don't agree.


I'd be interested to hear your reasons. *If* you take the sharp distinction
that python draws between statements and expressions as a given, then python's
syntax, in particular the choice to use indentation for block structure, seems
to me to be the best choice among what's currently on offer (i.e. I'd claim
that python's syntax is objectively much better than that of the C and Pascal
descendants -- comparisons with smalltalk, prolog or lisp OTOH are an entirely
different matter).


(I'm ignoring the followup-to because I don't read comp.lang.pytho n)

Indentation-based grouping introduces a context-sensitive element into
the grammar at a very fundamental level. Although conceptually a
block is indented relative to the containing block, the reality of the
situation is that the lines in the file are indented relative to the
left margin. So every line in a block doesn't encode just its depth
relative to the immediately surrounding context, but its absolute
depth relative to the global context. Additionally, each line encodes
this information independently of the other lines that logically
belong with it, and we all know that when some data is encoded in one
place may be wrong, but it is never inconsistent.

There is yet one more problem. The various levels of indentation
encode different things: the first level might indicate that it is
part of a function definition, the second that it is part of a FOR
loop, etc. So on any line, the leading whitespace may indicate all
sorts of context-relevant information. Yet the visual representation
is not only identical between all of these, it cannot even be
displayed.

Is this worse than C, Pascal, etc.? I don't know.
Worse than Lisp, Forth, or Smalltalk? Yes.

Jul 18 '05 #30

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

Similar topics

220
18872
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it...
37
2759
by: michele.simionato | last post by:
Paul Rubin wrote: > How about macros? Some pretty horrible things have been done in C > programs with the C preprocessor. But there's a movememnt afloat to > add hygienic macros to Python. Got any thoughts about that? "Movement" seems quite an exaggeration. Maybe 2-3 people made some experiments, but nobody within the core Python developers...
267
10577
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
14
2151
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...
206
8216
by: WaterWalk | last post by:
I've just read an article "Building Robust System" by Gerald Jay Sussman. The article is here: http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf In it there is a footprint which says: "Indeed, one often hears arguments against building exibility into an engineered sys- tem. For example, in the philosophy of...
0
7605
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...
0
7893
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...
0
6156
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...
1
5441
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5162
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...
0
3570
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...
1
2022
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
1
1141
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
845
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...

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.