summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sly/signal.scm4
1 files changed, 4 insertions, 0 deletions
diff --git a/sly/signal.scm b/sly/signal.scm
index 5bd9a29..42cce40 100644
--- a/sly/signal.scm
+++ b/sly/signal.scm
@@ -48,6 +48,7 @@
signal-drop
signal-drop-repeats
signal-switch
+ signal-if
signal-constant
signal-count
signal-tap
@@ -341,6 +342,9 @@ signal PRED is true, or the value of the signal OFF otherwise."
(%signal-set! self (current-value)))
(list predicate)))
+(define-syntax-rule (signal-if predicate consequent alternate)
+ (signal-map (lambda (true?) (if true? consequent alternate)) predicate))
+
(define (signal-constant constant signal)
"Create a new signal whose value is always CONSTANT no matter the
value of SIGNAL."