[comp.sys.transputer] Was: C to Occam translator

nick@vaila.cs.ed.ac.uk (Nick Rothwell) (10/02/90)

In article <4739@baird.cs.strath.ac.uk>, charles@cs.strath.ac.uk
(Charles X. Chen) writes:
|>(have you
|>ever heard anybody solve the Honoi tower problem in Occam?

Just as a matter of interest, you can solve Towers of Hanoi without
recursion, so it could be done.

Don't think much of OCCAM myself. I don't see what it really has to
offer over some kind of parallel C, and it's missing a hell of a lot.
Ideally, you want a garbage-collected language with first-class closures
so that you can get proper communication abstraction, pass functions through
channels, or pass channels through
channels to implement remote call-and-return, and this kind of thing.
Neither OCCAM nor C come close for this kind of thing.

                                  
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
 "Now remember - and this is most important - you must think in Russian."

J.Wexler@edinburgh.ac.uk (10/05/90)

> Just as a matter of interest, you can solve Towers of Hanoi without
> recursion, so it could be done.

You probably know this, Nick, but others may not: the non-recursive solution is
extremely simple, and it's not hard to prove all its interesting properties
either.  I think (I haven't time to verify my recollection) that it goes like
this:

1. Arrange the towers in a triangle, so that "clockwise" will have some meaning
in what follows.

2. Do repeatedly -

   2a. Move the smallest piece one place clockwise;

   2b. Exit if all pieces are on one tower;

   2c. Make any legitimate move which does not involve the smallest piece.

   (End Do)

John Wexler
Edinburgh Parallel Computing Centre

P.S. There is never a choice at move 2c.  There are alternative ways to specify
     the same move, which are more complicated to describe but lead to a
     simpler program in most sequential languages.  What I mean is that, as
     I have specified 2c, you would have to write a program which tests a choice
     of moves for legitimacy, and then makes the legitimate one.
     You can in fact predict which will be the legitimate one without doing
     the testing, but the rule is not so easy to express in a single English
     sentence.

dbc@ecs.soton.ac.uk (Bryan Carpenter) (10/05/90)

In <4739@baird.cs.strath.ac.uk> charles@cs.strath.ac.uk (Charles X. Chen) writes:

>them. For instance, if you want recursion, don't use Occam! (have you
>ever heard anybody solve the Honoi tower problem in Occam? is there

See

W.D. Crowe & P.E.D. Strain-Clark, "A Concurrent Approach to the
Towers of Hanoi", in "Occam and the Transputer - Research and
Applications" ed. C. Askew (Proceedings of 9th OUG Technical Meeting,
1988).

Actually they don't quite give an occam implementaion - but it's
close.