From: Zhu Zihao <all_but_last@163.com>
To: Olivier Dion <olivier.dion@polymtl.ca>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: Pretty print bytevectors with its content in hex format
Date: Tue, 04 Oct 2022 18:49:34 +0800 [thread overview]
Message-ID: <86sfk3g8tr.fsf@163.com> (raw)
In-Reply-To: <87wn9kkhxr.fsf@laura>
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
> 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 <bytevector>) 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 :)
--
Retrieve my PGP public key:
gpg --recv-keys B3EBC086AB0EBC0F45E0B4D433DB374BCEE4D9DC
Zihao
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]
prev parent reply other threads:[~2022-10-04 10:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 8:41 Pretty print bytevectors with its content in hex format Zhu Zihao
2022-09-30 15:20 ` Olivier Dion via Developers list for Guile, the GNU extensibility library
2022-10-04 10:49 ` Zhu Zihao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86sfk3g8tr.fsf@163.com \
--to=all_but_last@163.com \
--cc=guile-devel@gnu.org \
--cc=olivier.dion@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).