From b967b4b116e70ab0e2eb1c4b39ec6534e071dfff Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 12 Dec 2013 22:38:01 -0500 Subject: Add signal-liftn procedure. * 2d/signals.scm (signal-liftn): New procedure. --- 2d/signals.scm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to '2d') 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 -- cgit v1.2.3