Add christine's pk (cpk) and cpk-values!
This commit is contained in:
parent
4ac39aebd1
commit
a4938d04e1
1 changed files with 25 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
#:use-module (ice-9 textual-ports)
|
||||
#:use-module (ice-9 exceptions)
|
||||
#:use-module (ice-9 i18n)
|
||||
#:use-module (ice-9 pretty-print)
|
||||
#:use-module (web uri)
|
||||
#:use-module (web client)
|
||||
#:use-module (web request)
|
||||
|
@ -13,6 +14,8 @@
|
|||
@codepoint-range
|
||||
@comment
|
||||
@ws
|
||||
cpk-values
|
||||
cpk
|
||||
cons-hash-list!
|
||||
hex-string->integer
|
||||
format-exception-msg
|
||||
|
@ -95,4 +98,26 @@
|
|||
(with-input-from-file path
|
||||
(λ () (get-string-all (current-input-port)))) #\newline))
|
||||
|
||||
;; kludge: emacs mis-renders this as a string, so...
|
||||
(define hash-semicolon-semicolon
|
||||
(list->string '(#\# #\; #\;)))
|
||||
|
||||
;; for debugging
|
||||
(define (cpk . vals)
|
||||
"Peek at values for print debugging, but return 'em"
|
||||
(display hash-semicolon-semicolon (current-error-port))
|
||||
(display " cpk\n" (current-error-port))
|
||||
(pretty-print vals (current-error-port))
|
||||
;; return the last value
|
||||
(last vals))
|
||||
|
||||
(define-syntax-rule (cpk-values print-these ... body)
|
||||
;; Like pk, but supporting multiple value return
|
||||
(call-with-values
|
||||
(lambda () body)
|
||||
(lambda vals
|
||||
(display hash-semicolon-semicolon (current-error-port))
|
||||
(display " cpk-values\n" (current-error-port))
|
||||
(pretty-print (list print-these ... '*values:* vals)
|
||||
(current-error-port))
|
||||
(apply values vals))))
|
||||
|
|
Loading…
Reference in a new issue