summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2013-12-12 22:38:01 -0500
committerDavid Thompson <dthompson2@worcester.edu>2013-12-12 22:38:01 -0500
commitb967b4b116e70ab0e2eb1c4b39ec6534e071dfff (patch)
tree85ad82129333a7ff30f2c91d7a02fe2dd8fc3ea7
parent627f3ef4da15ac23f9959e72ed5cfb1855650b05 (diff)
Add signal-liftn procedure.
* 2d/signals.scm (signal-liftn): New procedure.
-rw-r--r--2d/signals.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/2d/signals.scm b/2d/signals.scm
index cd5cba0..94f8fe5 100644
--- a/2d/signals.scm
+++ b/2d/signals.scm
@@ -43,6 +43,7 @@
signal-lift2
signal-lift3
signal-lift4
+ signal-liftn
signal-merge
signal-combine
signal-fold
@@ -181,6 +182,14 @@ onto SIGNAL1, SIGNAL2, SIGNAL3, and SIGNAL4."
(signal-ref signal4)))
#:connectors (list signal1 signal2 signal3 signal4)))
+(define (signal-liftn transformer . signals)
+ "Create a new signal that lifts the procedure TRANSFORMER of arity n
+onto SIGNALS where n is the size of SIGNALS."
+ (make-signal
+ #:transformer (lambda (value prev from)
+ (apply transformer (map signal-ref signals)))
+ #:connectors signals))
+
(define (signal-merge . signals)
"Create a new signal that merges every signal in the list SIGNALS
into one. The value of the new signal is the value of the most