summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-08-27 17:49:30 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-08-27 17:49:30 -0400
commitab11771243296039bc4b3f96614446689677087b (patch)
tree828beda2501aed34ef81ccc1c4d0507c8f0cc2cc
parentde99fc7a0c67d8193d693fec1d7a32dd2713b2f8 (diff)
signal: Add signal-timestamp.
-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."