# [plt-scheme] Fr. Time questions

 From: David Stigant (dstigant at houston.rr.com) Date: Fri Sep 17 01:24:35 EDT 2004 Previous message: [plt-scheme] ATTN: Neil Van Dyke (and some philosophical musings on debuggers) Next message: [plt-scheme] Fr. Time questions Messages sorted by: [date] [thread] [subject] [author]

```1.  Dr. Scheme is still freezing regularly when I use Fr. Time.  It seems to happen more often when I have multiple instances of Dr. Scheme running concurrently.

2.  Is there a way to have the dynamic updating pause and resume?  Or perhaps ensure that several operations are atomic vs one update of the clock?  I've written some code to simulate gravity with a planet orbitting in a circle around a sun.  Essentially, each body is modelled with a struct which holds its mass, posn, velocity, acceleration, and a list of forces from other bodies.
acc = mass * (sum forces)
vel = (+ init-vel (integral acc))
posn = (+ init-posn (integral vel))

Now, I want to set up the planet with an initial velocity and position so that it will be in a circular orbit around the sun, and then afterwards, I need to add a force between the sun and the planet.  However, it appears that the force is not added until several seconds after the body has been initialized, and by that time, it has floated off into space.

I can post some more code if necessary, but its a bit on the messy side at the moment (lazy programmer syndrome).

3.  snapshot and value seem to freeze everything recursively.  For example, the following code:

(define x (new-cell 1))
(define y (new-cell 2))
(define z (new-cell (list x)))
(define add-element
(lambda (e)
(set-cell! z (cons e (value-now z)))

(add-element y)
(set-cell! x 3)
(set-cell! y 4)

z  ==> (4 1)

freezes the value of x within z to be 1 instead of allowing it to change freely, whereas the value of y has changed successfully.

I've coded around this as follows:
(define x (new-cell 1))
(define y (new-cell 2))
(define z-static (list x))
(define z (new-cell z-static))
(define add-element
(lambda (e)
(set! z-static (cons e z-static))
(set-cell! z z-static)))

(add-element y)
(set-cell! x 3)
(set-cell! y 4)

z ==> (4 3)

Is there a cleaner way to do this?  Perhaps a version of value-now/snapshot which only goes one level down?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20040917/c8d2c7f8/attachment.html>
```

 Posted on the users mailing list. Previous message: [plt-scheme] ATTN: Neil Van Dyke (and some philosophical musings on debuggers) Next message: [plt-scheme] Fr. Time questions Messages sorted by: [date] [thread] [subject] [author]