Strongtalk VM for Squeak
Markus Gaelli
gaelli at emergent.de
Tue Sep 19 15:37:19 UTC 2006
On Sep 19, 2006, at 5:19 PM, Ramon Leon wrote:
>
>> You know, replace "Smalltalk" with "Lisp" and you'll sound
>> just like Paul Graham :)
>
> :), no surprise, Lisp was one of Smalltalk inspirations. The two
> languages
> are very similar in many respects, I have much respect for Lisp, but I
> prefer Smalltalk.
>
>
Smalltalk is a more consistent environment whereas Lisp is a more
consistent language:
Experiments like evolutionary programming done by Hillis crossing
over lisp trees with a restricted vocabulary would be quite hard to
do in Smalltalk.
Yet I prefer my tweakable browsers over a tweakable emacs...
Btw., Paul's example for the conciseness of Lisp vs other languages
(including Smalltalk) is a but spoiled:
==========
As an illustration of what I mean about the relative power of
programming languages, consider the following problem. We want to
write a function that generates accumulators-- a function that takes
a number n, and returns a function that takes another number i and
returns n incremented by i.
(That's incremented by, not plus. An accumulator has to accumulate.)
In Common Lisp this would be
(defun foo (n)
(lambda (i) (incf n i)))
(...)
foo: n
|s|
s := n.
^[:i| s := s+i. ]
because although in general lexical variables work, you can't do an
assignment to a parameter, so you have to create a new variable s.
=========
What we _can_ do, is to define foo within the context of Number:
Number >> foo
^[:i | self + i]
Shorter, isn't it? ;-)
Cheers,
Markus
More information about the Squeak-dev
mailing list
|