Scheme - Convert boolean to string?

boolean, racket, scheme

Solution

Use `format`:

> (format "~a" #t)
"#t"
> (format "~a" #f)
"#f"

Problem

I am having a tough time trying to find an example of converting a boolean to a string in Scheme. My problem is that I use string-append to add a few strings together as part of a debugger. My fix was to check if equal to #t, then append "#t", and like-wise with #f. My question- is there a method in Scheme to convert bools to strings? Something like bool->string? My Code: ``` (if (equal? val #t) (string-append (number->string count) ":" "#t") (string-append (number->string count) ":" "#f") ) ```

Original source