guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pretty print bytevectors with its content in hex format


From: Zhu Zihao
Subject: Re: Pretty print bytevectors with its content in hex format
Date: Tue, 04 Oct 2022 18:49:34 +0800
User-agent: mu4e 1.8.9; emacs 29.0.50

> 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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]