Revision e664f52c5a0f9d9eaf7dd07b147e6e309ccfa4ce authored by Rafael Fourquet on 01 April 2017, 04:52:51 UTC, committed by Rafael Fourquet on 01 April 2017, 05:01:10 UTC
1 parent bd84fa1
Raw File
bin2hex.scm
(define (read-u8) (io.read *input-stream* 'uint8))
(define modulo mod)
(define display princ)
(let loop ((b (read-u8))
           (i 0))
  (if (not (eof-object? b))
      (begin
        (if (> i 0)
            (display ", "))
        (display "0x") (display (number->string b 16))
        (if (= 0 (modulo (+ 1 i) 16))
            (newline))
        (loop (read-u8) (+ 1 i)))))
(newline)
back to top