summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sly/signal.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/sly/signal.scm b/sly/signal.scm
index 543f4d0..da4e1dc 100644
--- a/sly/signal.scm
+++ b/sly/signal.scm
@@ -48,6 +48,7 @@
signal-constant
signal-count
signal-tap
+ signal-timestamp
signal-sample
signal-delay
signal-throttle
@@ -309,6 +310,12 @@ SIGNAL. This signal is a convenient way to sneak a procedure that has
a side-effect into a signal chain."
(signal-map (lambda (x) (proc x) x) signal))
+(define (signal-timestamp signal)
+ "Create a new signal whose value is a pair, the car of which is the
+time that the value of SIGNAL was received and whose cdr is the value
+of SIGNAL."
+ (signal-map (cut cons (agenda-time) <>) signal))
+
(define (signal-sample delay signal)
"Create a new signal that emits the value contained within SIGNAL
every DELAY ticks of the current agenda."