* Macro for Python-style debugging output
@ 2022-03-28 19:22 Jean Abou Samra
2022-03-30 19:08 ` Liliana Marie Prikler
0 siblings, 1 reply; 3+ messages in thread
From: Jean Abou Samra @ 2022-03-28 19:22 UTC (permalink / raw)
To: guile-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Macro for Python-style debugging output
2022-03-28 19:22 Macro for Python-style debugging output Jean Abou Samra
@ 2022-03-30 19:08 ` Liliana Marie Prikler
2022-03-31 2:38 ` Thien-Thi Nguyen
0 siblings, 1 reply; 3+ messages in thread
From: Liliana Marie Prikler @ 2022-03-30 19:08 UTC (permalink / raw)
To: Jean Abou Samra, guile-devel
Am Montag, dem 28.03.2022 um 21:22 +0200 schrieb Jean Abou Samra:
> 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?
I think using plain old 'peek' might be preferable in most cases.
While you're missing out on the LHS expression, you can mix it with
symbols arbitrarily, e.g. (peek 'my-function a b 'args+kwargs= rest)
Cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Macro for Python-style debugging output
2022-03-30 19:08 ` Liliana Marie Prikler
@ 2022-03-31 2:38 ` Thien-Thi Nguyen
0 siblings, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2022-03-31 2:38 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1.1: Type: text/plain, Size: 409 bytes --]
() Liliana Marie Prikler <liliana.prikler@gmail.com>
() Wed, 30 Mar 2022 21:08:12 +0200
I think using plain old 'peek' might be preferable in most
cases. While you're missing out on the LHS expression, you
can mix it with symbols arbitrarily, e.g. (peek 'my-function
a b 'args+kwargs= rest)
For those who use Emacs, please find attached here pk-unpk.el,
for augmenting your editing puissance:
[-- Attachment #1.2: pk-unpk.el --]
[-- Type: application/emacs-lisp, Size: 1911 bytes --]
[-- Attachment #1.3: Type: text/plain, Size: 376 bytes --]
--
Thien-Thi Nguyen -----------------------------------------------
(defun responsep (query) ; (2022) Software Libero
(pcase (context query) ; = Dissenso Etico
(`(technical ,ml) (correctp ml))
...)) 748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 219 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-31 2:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 19:22 Macro for Python-style debugging output Jean Abou Samra
2022-03-30 19:08 ` Liliana Marie Prikler
2022-03-31 2:38 ` Thien-Thi Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).