From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Liliana Marie Prikler Newsgroups: gmane.lisp.guile.devel Subject: Re: Macro for Python-style debugging output Date: Wed, 30 Mar 2022 21:08:12 +0200 Message-ID: References: <8bfae8ae-3965-1fc7-1ab0-d67b1c87a831@abou-samra.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21090"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.42.1 To: Jean Abou Samra , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Mar 31 01:15:56 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZhXg-0005GP-QF for guile-devel@m.gmane-mx.org; Thu, 31 Mar 2022 01:15:56 +0200 Original-Received: from localhost ([::1]:43390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZhXf-0003ei-DV for guile-devel@m.gmane-mx.org; Wed, 30 Mar 2022 19:15:55 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZdg2-00046O-I4 for guile-devel@gnu.org; Wed, 30 Mar 2022 15:08:18 -0400 Original-Received: from [2a00:1450:4864:20::544] (port=44583 helo=mail-ed1-x544.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZdg1-0000Dy-1B for guile-devel@gnu.org; Wed, 30 Mar 2022 15:08:18 -0400 Original-Received: by mail-ed1-x544.google.com with SMTP id w25so25554544edi.11 for ; Wed, 30 Mar 2022 12:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=IUc2q3rc1Ue6OmfV9R9dI+IbyXEGjpR5KUNm91d6HR4=; b=S/EuLTqWA1jN6zylUkrbgUxbQa5wp6JQ7two34cquJD/EXegxScxHHJVOj6b5Z9WSF vqKPRP0oOuoW9t37wgZv6PW5tE42S4lhnYJ5I/cgGKkaPA2JtQoLGlcm/BmtN33taeMD g/bFs0OWtqLG1skLkIBkDUJ2EMi/4TpRxIs/H51uNeZxRlv9IR+i/H+wqxOh9MHj/qMh ixCIQX1K3pSE+6VrvDnnAzoWh0n7DGsY0fmRdg5hUBKChdKeXSlbLeAqCNdRt2sJnRuP 9IOQaR20KeRGLW4Bm2UW/oJNYcnMgZ15IDzcs8isHGgQ4HBcY2dVQA4PkOeNCZcvXuhj vorA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=IUc2q3rc1Ue6OmfV9R9dI+IbyXEGjpR5KUNm91d6HR4=; b=oS0hv/1Rk8Y3EkcYoSBHrL8wU00r78kd11t/BsclrIaXbP2CqzKa+0ZelLF4Cm27kb 2R9jzCodcG9uOQV0nIMEidMgDgN3nyRdFv+c8g2GP8PuDvhd0lz73a0klNuClLh4McTo qgZGk4LePhKd/fAE1iPkehKo38bZOjGmdhy3oiGRGDjlnGrqqFmWRax68RruHXFJ4baJ 4uoQbLGJJRStA1MHWNzZ6CWMvDa0pLXnEeNtFKw0LwOUYKoY+qnIR6kjjoQrv28IeR64 yPjI6dj1lpWutekzCBZiMevB5WHm7Z0RgvKxcyAc4e532CBkg62J+0HhRChdGg3ppQ+4 BjvA== X-Gm-Message-State: AOAM532mfCeeWRWgE1/Udya68ZXZHcsrv8jIjCaUWqT3N4p/4Xlp/h16 2oZb+Zv+8Vntv+7dylv7iJU= X-Google-Smtp-Source: ABdhPJyxyga2mE7/+4akKSfD59iOym4CrJhXnT5cpmlVIm4NCxcll/3gWppXG4sMXlXnhUyGFeK+WA== X-Received: by 2002:aa7:d78f:0:b0:418:efc6:bf0e with SMTP id s15-20020aa7d78f000000b00418efc6bf0emr12333992edq.330.1648667294911; Wed, 30 Mar 2022 12:08:14 -0700 (PDT) Original-Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id u19-20020a170906125300b006ceb043c8e1sm8556002eja.91.2022.03.30.12.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 12:08:14 -0700 (PDT) In-Reply-To: <8bfae8ae-3965-1fc7-1ab0-d67b1c87a831@abou-samra.fr> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::544 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::544; envelope-from=liliana.prikler@gmail.com; helo=mail-ed1-x544.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 30 Mar 2022 19:15:43 -0400 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21184 Archived-At: 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