Printf string representation as a list element


I can see this in REPL:

"in-test.rkt"> (define lst (list "alfa" 42))
"in-test.rkt"> lst
'("alfa" 42)
"in-test.rkt"> (printf "~a\n" lst)
(alfa 42)

I should much prefer it being quoted in the last line. Is there a way?

Hi, @Tyrn.

I think what you may be looking for is ~v:

> (printf "~v\n" lst)
'("alpha" 42)

See in particular the section on fprintf, here. I am myself not overly familiar with all of the ~* variants.