“Marcin ‘Qrczak’ Kowalczyk” qrczak@knm.org.pl wrote in message
news:slrnamv94n.e9e.qrczak@qrnik.zagroda…
Fri, 23 Aug 2002 20:38:10 +0900, Damon adamon@mailandnews.com pisze:
Can someone elaborate on this? I’ve seen passing references to this
assertion that Python and Lisp have somewhat related in design and
principles elsewhere, but did not fully understand the reasons why.
Can someone please elaborate on them?
http://www.google.com.pl/search?q=python+lisp
First few hits talk about interesting comparisons of these languages.
I admire Paul Graham’s writings, but I also noticed this Python-Lisp thing.
I wrote a letter to Paul Graham saying that everything he says about Python
being close to Lisp is applicable to Ruby.
Here is my letter :
In some of your articles you write about Python being one of the
closest to Lisp among non-Lisp languages. I agree that Python is
powerful, but I would like to add that everything you said about
Python is applicable to Ruby.
Let me prove it.
In Revenge of the Nerds you write:
Python users might legitimately ask why they can't just write
def foo(n):
return lambda i: return n += i
or even
def foo(n): lambda i: n += i
and my guess is that they probably will, one day.
Well… (I am smiling ear-to-ear). I can already do this in
Ruby, today:
def foo n
lambda {|i| n += i }
end
Actually, lambda is a synonym for the constructor of Proc class -
Proc.new :
def foo n
Proc.new {|i| n += i }
end
Semantically Proc.new is just what lambda is in functional
languages, that is why is has this synonym.
The page What Languages Fix on your site suggests that Ruby is
improved Perl (because Perl is a kludge). I understand that the way
things are described on the page does not claim to be the ultimate
word in language etimology, but because I know this is a common
misunderstanding to think that Ruby is an attempt at better Perl,
let me say:
Ruby is _not_ improved Perl
Yes, it has borrowed much from Perl, it has Perl compatible
regexps, plus some syntax sugar features. But in terms of
language design Ruby is a descendant of Smalltalk, not Perl. I
think I won’t be very far from the truth if I say that Ruby is
Smalltalk with familar C/Pascal-like syntax and smaller class
library.
With this in mind, I can point to major differences between Python
and Ruby. In Ruby there are no primitive types, only classes and
objects. Python is moving towards this complete object-orientedness
only now. Ruby has always had iterators, and all libraries make use
of them, while Python has gotten them only recently, and it looks
like an add-on.
Of course, Python has advantages over Ruby, some of them lie in the
sphere of language implementation, not in language design.
</my letter>
And here is his answer:
The reason I used Python as an example in RotN was just
that I thought Ruby wasn't yet widely enough used.
I know it is even more like Lisp than Python. As for
the description in what languages fix, those are
nearly all submitted by other people. It may well be
that the answer for Ruby is that "Smalltalk's syntax
is unfamiliar and it doesn't have regexps."
Ssssooo, this makes me admire the man even more ;-)))
Btw, who had this bright idea to add this synonym for
Proc.new, lambda? Matz ?
Best regards,
Yuri Leikind