Is the Universe Racket a Training Example of FRP?

Is 2htdp / universe learnpack a good (or bad or not) example of functional reactive programming?

It seems to fit the concept (a new state of the world is based on each tick / input), but I have never seen the FRP label associated with it.

+7
reactive-programming frp racket
source share
1 answer

The Racket family of programming languages ​​comes with FrTime , a language that turns (most of) Racket into FRP. If you run this interaction on the command line, for example,

> (current-time) Tue Jul 2 09:31:06 EDT 2013 

you constantly see the right time. (Well, this was used to work with current-seconds , an error report works in the work). As far as I can tell, frtime treats variables as event streams, and this idea is important for FRP.

The universe program, unlike it, explicitly associates event handlers (and rendering functions) with certain OS hooks (for example, mouse clicks). These handlers get the full state and return the full state plus action requests (for example, sending a message). In this sense, the universe is not a FRP language.

If you were to split languages ​​into explicit vs implicit FRP languages, you can classify the Universier tutorial package as an explicit FRP language.

+10
source share

All Articles