summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-12-01 10:05:49 -0500
committerDavid Thompson <dthompson@member.fsf.org>2013-12-01 10:05:49 -0500
commitee4c0fc7438b4eb30957a4f32eb72d19c079709d (patch)
treea5dd389a47bbebf7e5e396d227ac7d0013f6c52b /2d
parent3b5096269a1a0ee2ad0e5ffbb08b363dd382242c (diff)
Add signal-lift3 and signal-lift4.
* 2d/signals.scm (signal-lift3, signal-lift4): New procedures.
Diffstat (limited to '2d')
-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