diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-11-15 10:01:28 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-11-15 10:01:28 -0500 |
commit | 168894b85b818d276968b8ab68800e3a1942bdf6 (patch) | |
tree | 1f1129ecc68704a8b4fdb2f014f0c19ce638b7b2 | |
parent | 8f48026c7f3c441711a2f13a7b4d2518ca80f66b (diff) |
signal: Add signal-call.
* sly/signal.scm (signal-call): New procedure.
* doc/api/signals.texi: Add docs.
-rw-r--r-- | doc/api/signals.texi | 5 | ||||
-rw-r--r-- | sly/signal.scm | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/doc/api/signals.texi b/doc/api/signals.texi index 0d8c589..f2773d2 100644 --- a/doc/api/signals.texi +++ b/doc/api/signals.texi @@ -218,3 +218,8 @@ the coroutine defined by @var{body}. A special @code{yield} syntax is available within @var{body} to specify which values are passed to the signal. @end deffn + +@deffn {Scheme Procedure} signal-call @var{proc-signal} . @var{arg-signals} +Create a new signal that applies the procedure within +@var{proc-signal} to the arguments in @var{arg-signals}. +@end deffn diff --git a/sly/signal.scm b/sly/signal.scm index 0ddda2a..e57e880 100644 --- a/sly/signal.scm +++ b/sly/signal.scm @@ -53,7 +53,8 @@ signal-every signal-timer signal-since signal-delay signal-throttle - signal-generator)) + signal-generator + signal-call)) ;;; ;;; Signals @@ -425,3 +426,9 @@ ticks." (lambda () body ...)) handler)) signal)) + +(define (signal-call proc-signal . arg-signals) + "Create a new signal that applies the procedure within PROC-SIGNAL +to the arguments in ARG-SIGNALS." + (apply signal-map (lambda (proc . args) (apply proc args)) + proc-signal arg-signals)) |