Revision ea75e7ed08965017ca4aed0b316a2c04ab3cc8f2 authored by Katharine Hyatt on 19 February 2017, 16:56:55 UTC, committed by Kristoffer Carlsson on 19 February 2017, 16:56:55 UTC
* Fix note formatting

* Add Example header and a doctest to math
1 parent 34b39f8
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