From a08647c5a9ce4fd52077c18c4667df593fccf196 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 10 Jul 2024 07:32:39 -0400 Subject: A few more fixes for propagator post. --- posts/2024-07-03-frp-with-propagators.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/posts/2024-07-03-frp-with-propagators.md b/posts/2024-07-03-frp-with-propagators.md index 8c109f2..ad7df44 100644 --- a/posts/2024-07-03-frp-with-propagators.md +++ b/posts/2024-07-03-frp-with-propagators.md @@ -603,11 +603,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 +627,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 +1034,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: -- cgit v1.2.3