summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sly/signal.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/sly/signal.scm b/sly/signal.scm
index 41dddf2..a3e79c4 100644
--- a/sly/signal.scm
+++ b/sly/signal.scm
@@ -29,6 +29,7 @@
#:export (signal?
make-signal
define-signal
+ signal-let signal-let*
hook->signal
signal-ref
signal-ref-maybe
@@ -167,6 +168,17 @@ be coerced into one."
((_ name value)
#'(define name (make-signal-maybe value))))))
+(define-syntax-rule (signal-let ((var signal) ...) body ...)
+ ((lambda (var ...) body ...) (signal-ref signal) ...))
+
+(define-syntax signal-let*
+ (syntax-rules ()
+ ((_ ((var signal)) body ...)
+ (signal-let ((var signal)) body ...))
+ ((_ ((var signal) . rest) body ...)
+ (signal-let ((var signal))
+ (signal-let* rest body ...)))))
+
;;;
;;; Higher Order Signals
;;;