3 ms·
It's very similar to continuous/discrete DSP. The classic example is the integral or the feedback loop. We often talk about circuits which have continuous logic
by tel 12y ago
It's very similar to continuous/discrete DSP. The classic example is the integral or the feedback loop. We often talk about circuits which have continuous logic in terms of integrators and feedback loops. Direct from [0] we have a computation of
Exp[t] = 1 + Integral[Exp[x], {x, 0, t}]
as
exp :: SF () Double
exp = proc () -> do
rec let e = 1 + i
i <- integral −< e
returnA −< e
The integral is approximate (of course) but the algorithm holds to approximation no matter what the sampling rate is---that can be chosen by the consumer of the algorithm. From [1] you have an example from a vision system where the algorithm is specified in physical terms w.r.t. the motion of vehicles within a video frame. Again, the sampling occurs when the FRP computation is executed not when it's constructed.
Probably the most tangible example for this audience is thinking about Javascript GUIs. A Javascript GUI might be thought of as depending upon continuous signals like the mouse position, current time, scroll position, etc and also a set of (instantaneous) events like mouse clicks, new data arriving from asynchronous requests, etc. The output is a continuous "state of the GUI" signal.
Ultimately, the actual mouse position and painting loops are discrete, obviously, but their sample rates may be chosen independently of the actual business logic.
[0] Liu, Cheng, Hudak. Causal Commutative Arrows and Their Optimization. http://cs.yale.edu/c2/images/uploads/ICFP-CCA.pdf http://cs.yale.edu/c2/images/uploads/ICFP-CCA.pdf
[1] Nilsson, Courtney, Peterson. Functional Reactive Programming, Continued. http://haskell.cs.yale.edu/wp-content/uploads/2011/02/workshop-02.pdf http://haskell.cs.yale.edu/wp-content/uploads/2011/02/worksh...
- kbeaty 12y agoThanks, that explains a lot. Very interesting indeed.