summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2d/signals.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/2d/signals.scm b/2d/signals.scm
index 28d2c6f..5a95f9e 100644
--- a/2d/signals.scm
+++ b/2d/signals.scm
@@ -40,6 +40,8 @@
signal-constant
signal-lift
signal-lift2
+ signal-lift3
+ signal-lift4
signal-merge
signal-combine
signal-count
@@ -143,6 +145,25 @@ onto SIGNAL1 and SIGNAL2."
(signal-ref signal2)))
#:connectors (list signal1 signal2)))
+(define (signal-lift3 transformer signal1 signal2 signal3)
+ "Create a new signal that lifts the procedure TRANSFORMER of arity 3
+onto SIGNAL1, SIGNAL2, and SIGNAL3."
+ (make-signal (lambda (value prev from)
+ (transformer (signal-ref signal1)
+ (signal-ref signal2)
+ (signal-ref signal3)))
+ #:connectors (list signal1 signal2 signal3)))
+
+(define (signal-lift4 transformer signal1 signal2 signal3 signal4)
+ "Create a new signal that lifts the procedure TRANSFORMER of arity 4
+onto SIGNAL1, SIGNAL2, SIGNAL3, and SIGNAL4."
+ (make-signal (lambda (value prev from)
+ (transformer (signal-ref signal1)
+ (signal-ref signal2)
+ (signal-ref signal3)
+ (signal-ref signal4)))
+ #:connectors (list signal1 signal2 signal3 signal4)))
+
(define (signal-merge signal1 signal2)
"Create a new signal that merges SIGNAL1 and SIGNAL2 into one. The
value of the new signal is the value of the most recently changed