Well, I made it decide together:
(define (print-word x) (if (not (<= -2147483648 x 4294967295)) (error 'print-word "ERROR This number is bigger than a word ~a" x) (let* ([positive-x (if (< x 0) (+ #x100000000 x) x)] [str (number->string positive-x 2)] [padded-str (string-append (make-string (- 32 (string-length str)) #\0) str)]) (build-string 39 (λ(i) (cond [(= (remainder (+ 1 i) 5) 0) #\space] [else (string-ref padded-str (- i (quotient i 5)))]))))))
This actually returns a line with spaces between every four digits, as it was actually quite difficult to read differently.
source share