diff options
-rw-r--r-- | css/dthompson.css | 7 | ||||
-rw-r--r-- | posts/2024-07-03-frp-with-propagators.md | 40 |
2 files changed, 29 insertions, 18 deletions
diff --git a/css/dthompson.css b/css/dthompson.css index 7bdd6a6..52fabf7 100644 --- a/css/dthompson.css +++ b/css/dthompson.css @@ -40,9 +40,10 @@ a:visited { pre { font-family: "Inconsolata",monospace; + width: calc(100% - 1rem); line-height: 110%; - min-width: 100%; - padding: 1rem; + overflow-x: auto; + padding: 0.5rem; background-color: #222034; color: #deeed6; border-radius: 4px; @@ -128,7 +129,7 @@ nav a:visited { .container { margin-left: 14rem; margin-right: 4rem; - max-width: 52rem; + max-width: 60rem; } } diff --git a/posts/2024-07-03-frp-with-propagators.md b/posts/2024-07-03-frp-with-propagators.md index da7d8b0..7d0b5da 100644 --- a/posts/2024-07-03-frp-with-propagators.md +++ b/posts/2024-07-03-frp-with-propagators.md @@ -11,13 +11,10 @@ about a decade now. I even wrote a couple of describing my experiments. My initial source of inspiration was [Elm](https://elm-lang.org/), the Haskell-like language for the web that [once had FRP](https://elm-lang.org/news/farewell-to-frp) as a -core part of the language. From there, I explored the academic -literature on the subject. - -(Sidenote: The Elm of 10 years ago looks quite different than the Elm -of today and I don’t know where to find that time-traveling Mario demo -that sent me down this path in the first place. That demo was really -cool! I’ll update this post later if I can find an archive of it.) +core part of the language. [Evan Czaplicki’s Strange Loop 2013 +talk](https://www.infoq.com/presentations/elm-reactive-programming/) +really impressed me, especially that Mario demo. From there, I +explored the academic literature on the subject. Ultimately, I created and then abandoned a library that focused on [FRP for games](/projects/sly.html). It was a neat idea, but the @@ -205,7 +202,7 @@ Flexibility”](https://mitpress.mit.edu/9780262045490/software-design-for-flexi > computational elements are propagators, **autonomous independent > machines interconnected by shared cells through which they > communicate**. Each propagator machine continuously examines the -> cells is is connected to, and adds information to some cells based +> cells it is connected to, and adds information to some cells based > on computations it can make from information it can get from others. > **Cells accumulate information and propagators produce > information**.” @@ -603,11 +600,12 @@ We need to perform a few operations with ephemerals: 1) Test if one ephemeral is *fresher* (more recent) than another -2) Compose the timestamps from several inputs to form an aggregate +2) Merge two ephemerals when cell content is added + +3) Compose the timestamps from several inputs to form an aggregate timestamp for an output, but only if all timestamps for each distinct identifier match (no mixing of fresh and stale values) -3) Merge two ephemerals when cell content is added ```scheme (define (ephemeral-fresher? a b) @@ -626,7 +624,8 @@ identifier match (no mixing of fresh and stale values) (cond ((nothing? old) new) ((nothing? new) old) - (else (if (ephemeral-fresher? new old) new old)))) + ((ephemeral-fresher? new old) new) + (else old))) (define (merge-ephemeral-timestamps ephemerals) (define (adjoin-keys alist keys) @@ -1032,7 +1031,7 @@ constraint propagators: (define (build) (r:rgb->hsv rgb hsv) (r:hsv->rgb hsv rgb)) - (constraint-propagator 'r:components<->hsv (list rgb hsv) build)) + (constraint-propagator 'r:rgb<->hsv (list rgb hsv) build)) ``` At long last, we are ready to define the UI! Here it is: @@ -1130,6 +1129,16 @@ FRP system based on propagators since then that’s used in real software? I don’t know of anything but it’s a big information superhighway out there. +**Update**: Since publishing, I have learned about the following: + +* [Holograph](https://www.holograph.so/): A visual editor for + propagator networks! Amazing! + +* [Scoped + Propagators](https://www.orionreed.com/posts/scoped-propagators): A + WIP propagator system with some notable differences from + “traditional” propagators. + I wish I had read Alexey Radul's disseration 10 years ago when I was first exploring FRP. It would have saved me a lot of time spent running into problems that have already been solved that I was not @@ -1139,9 +1148,10 @@ model. That conversation was focused on AI, though, and I didn’t realize that propagators could also be used for FRP. It wasn’t until more recently that friend and colleague [Christine Lemmer-Webber](https://dustycloud.org/), who was present for the -aforementioned conversation with Sussman, told me about it. There are -so many interesting things to learn out there, but I am also so tired. -Better late than never, I guess! +aforementioned conversation with Sussman, told me about it. Christine +has [her own research project](https://gitlab.com/spritely/brainy) for +propagators. There are so many interesting things to learn out there, +but I am also so tired. Better late than never, I guess! Anyway, if you made it this far then I hope you have enjoyed reading about propagators and FRP. ’Til next time! |