* How to use ~c with v parameter in (ice-9 format)?
@ 2024-11-10 23:39 Tomas Volf
2024-11-10 23:57 ` Tomas Volf
2024-11-11 0:42 ` Matt Wette
0 siblings, 2 replies; 4+ messages in thread
From: Tomas Volf @ 2024-11-10 23:39 UTC (permalink / raw)
To: guile-user
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]
Hello,
when reading the documentation for (ice-9 format), this part of
description of ~c caught my eye:
> If the charnum parameter is given then an argument is not taken but
> instead the character is (integer->char charnum) (see
> Characters). This can be used for instance to output characters given
> by their ASCII code.
I wanted to give it a try, so I took the example from documentation and
run it in a REPL.
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use (ice-9 format)
scheme@(guile-user)> (format #f "~65c")
;;; <stdin>:29:0: warning: "~65c": wrong number of `format' arguments: expected 1, got 0
$7 = "A"
--8<---------------cut here---------------end--------------->8---
So, it does indeed return "A", however is also prints a warning. Am I
doing something wrong? Or is the documentation out-dated and `charnum'
parameter should be used in a different way?
Have a nice day,
Tomas
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to use ~c with v parameter in (ice-9 format)?
2024-11-10 23:39 How to use ~c with v parameter in (ice-9 format)? Tomas Volf
@ 2024-11-10 23:57 ` Tomas Volf
2024-11-11 0:42 ` Matt Wette
1 sibling, 0 replies; 4+ messages in thread
From: Tomas Volf @ 2024-11-10 23:57 UTC (permalink / raw)
To: guile-user
PS: The subject is misleading. I originally noticed the warning with ~vc, but during writing the email realized that ~65c warns as well and forgot to adjust it.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to use ~c with v parameter in (ice-9 format)?
2024-11-10 23:39 How to use ~c with v parameter in (ice-9 format)? Tomas Volf
2024-11-10 23:57 ` Tomas Volf
@ 2024-11-11 0:42 ` Matt Wette
2024-11-13 18:37 ` Tomas Volf
1 sibling, 1 reply; 4+ messages in thread
From: Matt Wette @ 2024-11-11 0:42 UTC (permalink / raw)
To: guile-user
On 11/10/24 3:39 PM, Tomas Volf wrote:
> Hello,
>
> when reading the documentation for (ice-9 format), this part of
> description of ~c caught my eye:
>
>> If the charnum parameter is given then an argument is not taken but
>> instead the character is (integer->char charnum) (see
>> Characters). This can be used for instance to output characters given
>> by their ASCII code.
> I wanted to give it a try, so I took the example from documentation and
> run it in a REPL.
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> ,use (ice-9 format)
> scheme@(guile-user)> (format #f "~65c")
> ;;; <stdin>:29:0: warning: "~65c": wrong number of `format' arguments: expected 1, got 0
> $7 = "A"
> --8<---------------cut here---------------end--------------->8---
>
> So, it does indeed return "A", however is also prints a warning. Am I
> doing something wrong? Or is the documentation out-dated and `charnum'
> parameter should be used in a different way?
>
> Have a nice day,
> Tomas
>
This looks like a bug in the compiler to me.
For example, check the `format-analysis' procedure in
language/tree-il/analyze.scm
try this: (apply format #f "~65c" '())
Matt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to use ~c with v parameter in (ice-9 format)?
2024-11-11 0:42 ` Matt Wette
@ 2024-11-13 18:37 ` Tomas Volf
0 siblings, 0 replies; 4+ messages in thread
From: Tomas Volf @ 2024-11-13 18:37 UTC (permalink / raw)
To: Matt Wette; +Cc: guile-user
[-- Attachment #1: Type: text/plain, Size: 555 bytes --]
Matt Wette <matt.wette@gmail.com> writes:
> This looks like a bug in the compiler to me.
Will send a bug report.
> For example, check the `format-analysis' procedure in
> language/tree-il/analyze.scm
I had a look, but have to admit that procedure is beyond me, at least
for now.
>
> try this: (apply format #f "~65c" '())
Yes, this works great, will use this as a work around. Thanks :)
Have a nice day,
Tomas
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-13 18:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-10 23:39 How to use ~c with v parameter in (ice-9 format)? Tomas Volf
2024-11-10 23:57 ` Tomas Volf
2024-11-11 0:42 ` Matt Wette
2024-11-13 18:37 ` Tomas Volf
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).