Re: How to use ~c with v parameter in (ice-9 format)?

Matt Wette <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.