[plt-scheme] Question on Teaching Scheme with DrScheme

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Nov 6 00:40:59 EST 2002

On Nov  5, Jerzy Karczmarczuk wrote:
> In both, and in Smalltalk in particular it is easier to code complex
> interactions, like in Alice.

OK, so after digging that up, going through the agony of booting
Windows and all the crashes that comes with it (and with Alice), I
still don't get the above point.  I didn't see any particularly
complex way of coding interactions.  Is the only point of this only
the DoInOrder and DoTogether?  If so, then what's the problem of doing
it in Scheme?  -- Something like this works any any expressions:

  > (define-syntax seq
      (syntax-rules () ((_ expr ...) (begin expr ... (void)))))
  > (define-syntax sim
      (syntax-rules ()
        ((_ expr ...)
         (begin (object-wait-multiple #f (thread (lambda () expr)) ...)
                (void)))))
  > (define (f x n)
      (let loop ((n n))
        (printf "~a\n" x) (sleep 1/4) (when (> n 0) (loop (sub1 n)))))
  > (sim (f 'x 4) (seq (f 'y 2) (f 'z 2)))
  y
  x
  x
  y
  y
  x
  x
  z
  z
  x
  z

and it's even easier when you deal with atomic operations that are
represented as things you know how much time it takes to execute them
(I would be very surprised if they implement those combinators with
the above).

This is not to say that it's a cute project with a much better
environment than other 3D software I saw so far, but is there anything
besides the above which is supposed to be something which is much more
natural in Python than in Scheme?  (Actually for such simple
constructs that are applied to such a domain, Haskell should do well
too, very similar to the reason Haskore is good for composing, where
you have these combinations (together with (infinite) loops etc etc)
as basic components.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.