summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
Diffstat (limited to '2d')
-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