guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Macro for Python-style debugging output


From: Jean Abou Samra
Subject: Macro for Python-style debugging output
Date: Mon, 28 Mar 2022 21:22:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

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

[Prev in Thread] Current Thread [Next in Thread]