[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> Re: Why not a sequential ToonTalk?



Brian Harvey wrote in message <73phsa$218$1@agate.berkeley.edu>...
>
>My question is, why does it have to be either/or?  StarLogo is about as
>parallel as a language can get, but it still allows composition of
>functions where that's appropriate.
>
>When kids play games, there are lots of sequential things that happen.
>First you hit the ball, then you run around the bases.  I think this
>business about sequential VERSUS parallel is a red herring.  The question
>is why you feel the need to throw 3,000 years of mathematics out the
>window just because you have a new idea -- can't you still remember the
>old ideas?  (Just in case it's not obvious, the 3,000 years are about
>composition of functions.)
>

I happen to think functional composition is a red herring. It is only a
SYNTATIC issue. Consider computing the number of seconds in a day. You can
use functional composition and enter an expression like

(* hours_in_a_day (* minutes_in_an_hour seconds_in_a_minute))

or you can avoid functional composition and write

(let ((seconds_in_an_hour (* minutes_in_an_hour seconds_in_a_minute))
  (* hours_in_a_day seconds_in_an_hour)
)

I don't see this as a big issue. One could even argue that the second way is
a better programming style since you name intermediate results. And logic
and relations are at least as old as functions. Functions are just a special
case of relations that are many-to-one.

>In fact, from my point of view, it's particularly ironic that you use
>"sequential" as a dirty word, since TT is much *more* sequential than
>any other programming language I've ever seen, even BASIC.  Where I can
>say
> (2+3) * (4+5)
>putting my focus on the answer I want, you have to say
> pick up a 2
> put it in a box
> pick up a 3
> put it on top of the box
> wait a few minutes while they get bammed together
> now put that down and pick up another box
> pick up a 4
> put it in a box
> pick up a 5
> put it on top of the box
> wait a few more minutes
> get the 9 out of the box
> somehow (I haven't gotten that far yet) put a times sign

Type x, X, or * while holding the 9.

>   in front of it
> now pick up the 5 from the 2+3
> put it on the X9
> wait some more
>You call that not sequential?

Yes, it is expressed sequentially. But this style is only when using
primitive operations like arithmetic. (And since pure arithmetic is very
easy to parallelize this could run in parallel in principle.)  A purist
could train a robot to take a box with 2 numbers and bird, combine the
numbers appropriately and give the bird the result. You can then program
(2+3) * (4+5) by loading up trucks with this robot so it does run in
parallel. This is sometimes a better style. It is used in the doubly
recursive version of factorial (see www.toontalk.com/English/programs.htm).)

ToonTalk provides an "immediate mode" version of arithmetic because I
believe it is easier (and more fun since Bammer the Mouse is popular with
kids). But the computer scientist in me thinks I shouldn't have made a
special case of arithmetic when it wasn't strictly necessary. Prolog, by the
way, also provides a special syntax for arithmetic that isn't strictly
necessary.

It is true that you hit the ball before you run around the bases. The design
question here is whether you make a more complex language and implementation
and support both parallel and sequential executions or not. I chose to keep
things simple. So to program this you need to have the part of the program
that decides that a ball is hit to give a bird a token indicating that the
ball has been hit. The part of the program for running around the bases has
to be waiting for that token to arrive before starting. It is not that hard
to express things this way.

Best,

-ken kahn (www.toontalk.com)








---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home