From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.devel Subject: Re: Macro for Python-style debugging output Date: Wed, 30 Mar 2022 22:38:51 -0400 Message-ID: <87bkxmlubo.fsf@gnuvola.org> References: <8bfae8ae-3965-1fc7-1ab0-d67b1c87a831@abou-samra.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18083"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Mar 31 04:39:24 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 1nZkia-0004Wj-Hm for guile-devel@m.gmane-mx.org; Thu, 31 Mar 2022 04:39:24 +0200 Original-Received: from localhost ([::1]:56344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZkiY-0007m0-ST for guile-devel@m.gmane-mx.org; Wed, 30 Mar 2022 22:39:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZkiK-0007ls-Nq for guile-devel@gnu.org; Wed, 30 Mar 2022 22:39:08 -0400 Original-Received: from delivery.mailspamprotection.com ([185.56.84.13]:48775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZkiI-00053e-46 for guile-devel@gnu.org; Wed, 30 Mar 2022 22:39:07 -0400 Original-Received: from 241.110.209.35.bc.googleusercontent.com ([35.209.110.241] helo=giow1035.siteground.us) by se20.mailspamprotection.com with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1nZkiD-000195-94 for guile-devel@gnu.org; Wed, 30 Mar 2022 21:39:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnuvola.org ; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=j0+NNMNVnXIl14/P4nOVzp1eoCeNO0Q/pyTAPBiKLbM=; b=m7W0HBGVyCT49srRhlUThNUwM4 eHVDV78F7nlnqihRBOSytt9LyZAmzDRVbMwIG0TwFc/Wv52RPaTt0ks1Cgn3W4TWgssofCSNdrSkp NMNYTSPCU2AvsJ+DzkJtRmg2ZPhOsdetmCevPc4I0zHNHlQKeEJDBeeVwx3JRIbnehpU=; Original-Received: from [50.89.166.226] (port=39074 helo=abolire) by giow1035.siteground.us with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.90-.1) (envelope-from ) id 1nZkiC-000DnB-Rz for guile-devel@gnu.org; Thu, 31 Mar 2022 02:39:00 +0000 In-Reply-To: (Liliana Marie Prikler's message of "Wed, 30 Mar 2022 21:08:12 +0200") X-Originating-IP: 35.209.110.241 X-SpamExperts-Domain: giow1035.siteground.us X-SpamExperts-Username: 35.209.110.241 Authentication-Results: mailspamprotection.com; auth=pass smtp.auth=35.209.110.241@giow1035.siteground.us X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.29) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT/W+EzVNAQ3M69b8DJSmMQGPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5y4gxIXbEKH7ssFv2TkqIrwqA/pdxL9H6My4aKblWy1swYP m8RQDikWSAmf9DpB7H5aa40DxZPJuLUk3zkVKd8pdqDuc9lS3Nx+9iKFZ9qooJJVRKyFCRrxWkR6 oZhlSr3iU9SJu5ErFaQSiiEg42mCiFKfD1jKgYfH+6S5qDVYoOxxSFay8uLOH9eLp/bvns8XKu1V bgppFJRGoXLED7mHFMezBtsH+Fr5latICLxKTLF7XtAh+BMY6BfObX3/dANR1KFcGqMiorHmOcHv PdiGGnd5bMZA642MQGj9YRs9EBjUOmSnUu+ib6eENMSiUHaQHXehajF9VN8il9+E/vSHVpGb8ted /DA8b4vk3ZTlWN2BGPrKtAC7FsU49Klio9+YsXTCpNwQX5GuA33x6QVqaggHkNHKqJzNZuHo4cbr sUXtQhr43M8eCrxQqJFh3M54nzxvje8eZ3fS7i47mF8XB392eNvDmAiz8zBDUDaN5yk4xAm9D8KT eKJT7gNACPfBp8GgCRFRXP2MsoebOSvo2Yuh6t0fbK+w91teuBhto0LDCHVra8qlPgDiPXVvotbY 3dkIJso6xzAWkfaUrWeVB5hQ6nsDvccjqgmDvD9Wh3cQKzHbbzEgp2eOx13KaKnM/PFqE+qWB2Ex +ON9GuUcEmXxzRzRAAO4r3HiRIRPq+Wlc1fqXub/7zceJVoZJwuZ3gYQJ0zMrx3Ec/sSwGkJkilT ObJ/1fNBRIw4b2ya6Nlyk+AQkotsP X-Report-Abuse-To: spam@quarantine1.mailspamprotection.com Received-SPF: pass client-ip=185.56.84.13; envelope-from=ttn@gnuvola.org; helo=delivery.mailspamprotection.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:21185 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain () 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: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=pk-unpk.el Content-Transfer-Encoding: quoted-printable ;;; pk-unpk.el --- Commands to instrument Scheme code ;; Copyright (C) 2002, 2007 Thien-Thi Nguyen ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Author: Thien-Thi Nguyen ;;; Commentary: ;; `M-x pk' asks you for a string to insert as `pk' arguments. ;; For example: ;; ;; (let ((answer (compute-answer))) ...) ;; ^ ;; point is here ;; ;; Try `M-x pk' then type ;; ;; 'answer 'is ;; ;; The code then looks like: ;; ;; (let ((answer (pk 'answer 'is (compute-answer)))) ...) ;; ;; `M-x unpk' searches backwards and upwards for a `pk' form and removes ;; it, or signals error if one cannot be found. ;;; Code: (defun pk (tag) (interactive "sTag (`pk' args): ") (skip-chars-forward " \t\n") (save-excursion (insert "(pk " tag " ") (forward-sexp) (insert ")"))) (defun unpk () (interactive) (skip-chars-forward " \t\n") (while (not (looking-at "(pk")) (when (zerop (current-column)) (error "could not find surrounding pk")) (backward-up-list 1)) (let ((p (point))) (forward-sexp 1) (delete-char -1) (forward-sexp -1) (delete-region p (point)))) (provide 'pk-unpk) ;;; pk-unpk.el ends here --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 Thien-Thi Nguyen ----------------------------------------------- (defun responsep (query) ; (2022) Software Libero (pcase (context query) ; =3D Dissenso Etico (`(technical ,ml) (correctp ml)) ...)) 748E A0E8 1CB8 A748 9BFA =2D-------------------------------------- 6CE4 6703 2224 4C80 7502 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iG4EARECAC4WIQR0jqDoHLinSJv6bORnAyIkTIB1AgUCYkUUPRAcdHRuQGdudXZv bGEub3JnAAoJEGcDIiRMgHUCMMIAoMdy1bNeyQORa2mS1DQL7SxXc3kQAKDAsCxx UqzpTllo30UE3x8ud2rFdg== =CfGb -----END PGP SIGNATURE----- --==-=-=--