From 98264afe030eef3b5bbabc03b76808253ce10d14 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 3 Mar 2023 11:26:34 +0100 Subject: [PATCH] Add peek-error, pke. Debuging using `pk' is popular in Guile, but not really usable if your program is as (pseudo-)filter, i.e., writing its output to stdout. * module/ice-9/boot-9.scm (peek-error, pke): New procedures. --- module/ice-9/boot-9.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index dc3537063..639aaaa79 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -183,6 +183,16 @@ This is handy for tracing function calls, e.g.: (define pk peek) +(define (peek-error . stuff) + "Like peek (peok), writing to (CURRENT-ERROR-PORT)." + (newline (current-error-port)) + (display ";;; " (current-error-port)) + (write stuff (current-error-port)) + (newline (current-error-port)) + (car (last-pair stuff))) + +(define pke peek-error) + (define (warn . stuff) (newline (current-warning-port)) (display ";;; WARNING " (current-warning-port)) -- 2.39.1