The following macro is a variant of peek that mimics Python's = format
specifier (e.g. print(f"{a=} {a+b=}")) by printing expressions and the
values they evaluate to.

(define-syntax-rule (db arg ...)
  (begin
    (let ((evaluated-arg arg))
      (format (current-error-port) ";;; ~s => ~s\n" (quote arg) evaluated-arg)
      evaluated-arg)
    ...))

Am I reinventing the wheel? Does anyone see value in this
being added to Guile?

Thanks,
Jean


Reply via email to