From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zhu Zihao Newsgroups: gmane.lisp.guile.devel Subject: Re: Pretty print bytevectors with its content in hex format Date: Tue, 04 Oct 2022 18:49:34 +0800 Message-ID: <86sfk3g8tr.fsf@163.com> References: <86czbdp7xa.fsf@163.com> <87wn9kkhxr.fsf@laura> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28329"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.9; emacs 29.0.50 Cc: guile-devel To: Olivier Dion Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Tue Oct 04 12:52:52 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 1offXf-0007EA-Gb for guile-devel@m.gmane-mx.org; Tue, 04 Oct 2022 12:52:51 +0200 Original-Received: from localhost ([::1]:60964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1offXe-0000OG-JZ for guile-devel@m.gmane-mx.org; Tue, 04 Oct 2022 06:52:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1offXT-0000Nb-GS for guile-devel@gnu.org; Tue, 04 Oct 2022 06:52:39 -0400 Original-Received: from mail-m975.mail.163.com ([123.126.97.5]:14886) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1offXM-0004cQ-NP for guile-devel@gnu.org; Tue, 04 Oct 2022 06:52:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=lGoDL OHO0WZioZEowKdytxEDXyTlG+MKnnmFOw2FLfE=; b=W4RuHMrNu/osdT/xzzNCx XYFgXYtnDvcwNHFBFb92hml7vUdI0xexHabcsOEA5C85USS093Q2IgyAxY1KD686 3Ai91kUtAQmDHJzUnItHIrhcqw9MPR8bL0W/NcwuwXNTn2zUc21lIZGtN6DHOKCs 6rm/lAbbX9T+1cnWsDjISI= Original-Received: from asus-laptop (unknown [163.125.249.136]) by smtp5 (Coremail) with SMTP id HdxpCgBnPARlEDxjqSlFhg--.64087S2; Tue, 04 Oct 2022 18:52:21 +0800 (CST) In-reply-to: <87wn9kkhxr.fsf@laura> X-CM-TRANSID: HdxpCgBnPARlEDxjqSlFhg--.64087S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvj4RXnYzUUUUU X-Originating-IP: [163.125.249.136] X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/xtbBPQWQr2AZCl492wAAsM Received-SPF: pass client-ip=123.126.97.5; envelope-from=all_but_last@163.com; helo=mail-m975.mail.163.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:21384 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > Right. The Guile printer has no option of that sort yet. Quickly I > would think that this should work: > > (use-modules (oop goops)) > > (define-method (display (bv ) port) > (format port "#vu8(~{#x~x~})" (bytevector->u8-list bv))) > > but I haven't tested it. Thanks for your help! I test your code in repl but it looks that procedure "display" is still not a generic function. If I test `(format port ....)` independently, it works well. Anyway, thanks a lot :) =2D-=20 Retrieve my PGP public key: gpg --recv-keys B3EBC086AB0EBC0F45E0B4D433DB374BCEE4D9DC Zihao --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIsEARYIADMWIQT4UAIrVkIEZilSHr2K2nJqP6LM8gUCYzwQUBUcYWxsX2J1dF9s YXN0QDE2My5jb20ACgkQitpyaj+izPKalAD/R4l/b3m1weeic7hn/E1bh/e4UlKM JFgC7iEcAdem/2MBAJs9+CmajWXKvHskyeVg5g70v5xZaqGI8RBh86yeOdwP =uLTE -----END PGP SIGNATURE----- --=-=-=--