summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-11-30 13:59:41 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-11-30 13:59:41 -0500
commite87d73810cb0a47cd31f9d0f3a65a4a39435883c (patch)
tree238ba360d03127bba58f16ad919f2ac793cb2cdb
parentcb6f2686e98bc964251951f33b8e597de25574a5 (diff)
signal: Add signal-time.
* sly/signal.scm (signal-time): New procedure.
-rw-r--r--sly/signal.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/sly/signal.scm b/sly/signal.scm
index 20d5ba6..bf69438 100644
--- a/sly/signal.scm
+++ b/sly/signal.scm
@@ -48,7 +48,7 @@
signal-constant
signal-count
signal-tap
- signal-timestamp
+ signal-timestamp signal-time
signal-sample
signal-every signal-since
signal-delay
@@ -318,6 +318,11 @@ of SIGNAL."
(signal-map (cut cons (agenda-time) <>) signal))
(define (signal-sample delay signal)
+(define (signal-time signal)
+ "Create a new signal whose value is the time that the latest value
+of SIGNAL was received."
+ (signal-map (lambda _ (agenda-time)) signal))
+
"Create a new signal that emits the value contained within SIGNAL
every DELAY ticks of the current agenda."
;; To prevent memory leaks, the new signal is stored within a weak