diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-12-06 11:15:00 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-12-06 13:20:49 -0500 |
commit | d7dbc7fc8e9c692fe9032d9f7738ffa59498034e (patch) | |
tree | 36ef381de09099c59d1e730624d2205948f520fa | |
parent | 5454c435e2c10e2e07ac7855528c12bcdb605494 (diff) |
signal: Add custom record type printer.
* sly/signal.scm: Set record type printer for <signal>.
-rw-r--r-- | sly/signal.scm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sly/signal.scm b/sly/signal.scm index 8e150a2..8e2c64d 100644 --- a/sly/signal.scm +++ b/sly/signal.scm @@ -24,6 +24,7 @@ (define-module (sly signal) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-26) #:use-module (sly agenda) #:use-module (sly coroutine) @@ -77,6 +78,15 @@ signal-box? (signal signal-unbox signal-box-set!)) +;; The user always sees the boxes, so let's hide the underlying +;; details. +(set-record-type-printer! + <signal-box> + (lambda (box port) + (let ((signal (signal-unbox box))) + (format port "#<signal value: ~a inputs: ~a>" + (%signal-ref signal) (signal-inputs signal))))) + ;; Alternate spelling of signal-box? for the public API. (define signal? signal-box?) |