I want to control a simulated physical process by increasing/decreasing some variables using the keyboard or pointer. What I can see you must choose either TimePassing() or KeyPress() etc for change(). And I can understand you need two parallel running tasks. Then I start to think of using the "entry point" groupActivityOf(). Can you have two "tasks" or programs running on the same computer? Thus I would then let one task be updated using TimePassing() and the other with KeyPress().
CodePudding user response:
Daniel made me think differently, and here is an example that illustrate the combination of continuous time (sampled with dt) and events for change of the state, that actually works!
program = activityOf(state_0, change, picture)
state_0(rs) = (t0,u0)
t0 = 0
u0 = 0
change((t, u), KeyPress("Up")) = (t, u 1)
change((t, u), KeyPress("Down")) = (t, u-1)
change((t, u), TimePassing(dt)) = (t dt, u)
change((t, u), other) = (t, u)
picture(t, u) = pictures [translated(lettering(printed(t)),0,1), lettering(printed(u))]