Re: Macro for Python-style debugging output

2022-03-30 Thread Liliana Marie Prikler
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



Re: Macro for Python-style debugging output

2022-03-30 Thread Thien-Thi Nguyen

() Liliana Marie Prikler 
() 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:


pk-unpk.el
Description: application/emacs-lisp

-- 
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


signature.asc
Description: PGP signature