summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sly/signal.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/sly/signal.scm b/sly/signal.scm
index 8e2c64d..93e7716 100644
--- a/sly/signal.scm
+++ b/sly/signal.scm
@@ -39,7 +39,7 @@
signal-proc
signal-merge
signal-zip
- signal-map
+ signal-map signal-sample-on
signal-negate
signal-fold
signal-filter
@@ -239,6 +239,11 @@ or more SIGNALS."
(%signal-set! self (current-value)))
inputs)))
+(define (signal-sample-on value-signal sample-signal)
+ "Create a new signal that takes on the value of VALUE-SIGNAL
+whenever SAMPLE-SIGNAL is updated."
+ (signal-map (lambda _ (signal-ref value-signal)) sample-signal))
+
(define (signal-negate signal)
"Create a new signal whose value is the 'not' of the value of
SIGNAL."