Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LISP feature comparability to Smalltalk??

36 views
Skip to first unread message

atl

unread,
May 29, 1999, 3:00:00 AM5/29/99
to
I'm fairly new to LISP. Blocks in Smalltalk(statement
sequences enclosed in square brackets) are very flexible.
YOu must explicitly execute a statement by sending the value
message to the block. You can also assign blocks to
variables and pass them around. What LISP feature most
closely resembles Smalltalk blocks?


**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****

Erik Naggum

unread,
May 30, 1999, 3:00:00 AM5/30/99
to
* atl <anon...@web.remarq.com>

| I'm fairly new to LISP. Blocks in Smalltalk(statement sequences enclosed
| in square brackets) are very flexible. YOu must explicitly execute a
| statement by sending the value message to the block. You can also assign
| blocks to variables and pass them around. What LISP feature most closely
| resembles Smalltalk blocks?

lambda expressions, which are more powerful than blocks, of course, but
also slightly more verbose unless you invent your own syntax, which is
also trivial to do.

#:Erik
--
@1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century

Tim Bradshaw

unread,
May 30, 1999, 3:00:00 AM5/30/99
to
* atl wrote:
> I'm fairly new to LISP. Blocks in Smalltalk(statement
> sequences enclosed in square brackets) are very flexible.
> YOu must explicitly execute a statement by sending the value
> message to the block. You can also assign blocks to
> variables and pass them around. What LISP feature most
> closely resembles Smalltalk blocks?

A block is pretty much like a lambda expressions in Lisp, and FUNCALL
is the equivalent of sending the value message:

(setf f #'(lambda ()
(+ 1 2)))

(funcall f) -> 3

But you can also do rather more than this:

(setf f #'(lambda (y)
(+ 2 y)))

(funcall f 3) -> 5

(setf f (let ((v 0))
#'(lambda (&optional (inc 1))
(setf v (+ v inc)))))

(funcall f) -> 1
(funcall f) -> 2
(funcall f 11) -> 13

--tim

Tim Olson

unread,
May 30, 1999, 3:00:00 AM5/30/99
to
In article <31370322...@naggum.no>, Erik Naggum <er...@naggum.no> wrote:

| lambda expressions, which are more powerful than blocks, of course, but
| also slightly more verbose unless you invent your own syntax, which is
| also trivial to do.

How are lambda expressions more powerful than Smalltalk blocks? I'm much
more familiar with Scheme, but lambdas in Scheme appear to be equivalent
to blocks in Smalltalks that implement full closure semantics.

--

-- Tim Olson

Frank A. Adrian

unread,
May 30, 1999, 3:00:00 AM5/30/99
to
Except that the Smalltalk standard (IIRC) does not require that variables in
methods and blocks be lexically closed. Most commercial implementations
have this feature, but Squeak doesn't and Digitalk's Smalltalk V didn't have
it until 1994 or so (right before the merger w/ParcPlace). As we all know,
a feature that you can't depend on being there is not a feature of a
language. So for now, Smalltalk blocks ARE less powerful (in general) than
LISP blocks.

faa

Tim Olson <t...@jumpnet.com> wrote in message
news:tim-300599...@jump-tnt-0006.customer.jump.net...

Tim Olson

unread,
May 30, 1999, 3:00:00 AM5/30/99
to
In article <9Xh43.4197$Np1.2...@news.uswest.net>, "Frank A. Adrian"
<fad...@uswest.net> wrote:

| Except that the Smalltalk standard (IIRC) does not require that variables in
| methods and blocks be lexically closed.

The draft version I have (1.9) does seem to require that blocks be
implemented as closures:

-----
Section 3.4.4 Blocks

Expressions within a block may reference temporary variables and arguments
of the functions that enclose the block. Each block object is an
independent closure that captures the current bindings for any enclosing
functions' arguments or temporaries that are referenced from within the
block's <block constructor>. Any such captured bindings and their
associated discrete variables or objects must be preserved as long as the
block object continues to exist and is available for evaluation. Note that
the values of any such captured discrete variables and the state of any
object captured by an argument binding remain subject to possible
modification.
-----

You are correct that Squeak does not currently implement blocks like this,
but as far as I know all other Smalltalks do (and most folks are pushing
to have Squeak do so, as well).

--

-- Tim Olson

Frank A. Adrian

unread,
May 30, 1999, 3:00:00 AM5/30/99
to
Thanks for your adjustment of my memory. I don't want to denigrate
Smalltalk (it being my second favorite language and all). I was fairly
certain that all of the currently available commercial products were
lexically closed and I knew Squeak wasn't. I also remembered that the
Smalltalk standard was pretty weaselly and wimpy when it actually came to
nailing a lot of things down (e.g., exception processing, UI, MOP issues)
and the last time I checked (a long time ago), there was still a lot of
debate over how strict to make certain issues (lexical scoping being one of
them). Most of the cases had been resolved in terms of "let a thousand
flowers bloom", and I assumed that this one had, too. Mea culpa, and my
apologies to the Smalltalkers who check in here. At least they got this one
right :-)...

faa

Tim Olson <t...@jumpnet.com> wrote in message

news:tim-300599...@jump-tnt-0130.customer.jump.net...

atl

unread,
May 30, 1999, 3:00:00 AM5/30/99
to
so let me get this straight, the answer to my original
question is that lamba expressions are the LISP feature that
most closely resemble smalltalk blocks?

Ian Wild

unread,
May 31, 1999, 3:00:00 AM5/31/99
to
atl wrote:
>
> so let me get this straight, the answer to my original
> question is that lamba expressions are the LISP feature that
> most closely resemble smalltalk blocks?


Lambda expressions certainly resemble blocks *quite*
closely. Why do you insist on the feature that
"most closely" resembles blocks. Homework?

Erik Naggum

unread,
May 31, 1999, 3:00:00 AM5/31/99
to
* atl <anon...@web.remarq.com>

| so let me get this straight, the answer to my original question is that
| lamba expressions are the LISP feature that most closely resemble
| smalltalk blocks?

among symbols, complex numbers, hash tables, closures, streams, classes,
conditions, and a better syntax, just to take a few Lisp features, it
_still_ looks like closures most closely resemble Smalltalk blocks.

your question looks facetious. why are you asking such a funny question
and being so serious about it? what are you _really_ wondering about?

0 new messages