(define (hex x) (if (number? x) (if (zero? x) "0" (let y ((x x) (j 0)) (if (zero? (modulo x 16)) (y (/ x 16) (+ j 4)) (string-append (number->string x 16) (if (> j 0) (string-append "∙2^" (number->string j 10)) ""))))) (if (pair? x) (cons (hex (car x)) (hex (cdr x))) x))) ; ---------- (let* ((M 8) (z 2) (ls arithmetic-shift) (p2 (λ (n) (ls 1 n))) (÷ quotient) (num (p2 (+ M M z 2))) (topj (p2 (+ M z 1)))) (let dlp ((j (p2 (+ M z))) (maxlst #f)) (if (= j topj) maxlst (let* ((df (ls j (- 52 (+ M z)))) (krmax (ls df (+ M 1))) (N (÷ num (+ j 1))) (Nd (* N df)) (topr (* 2 df)) (nl (let rlp ((r (+ Nd Nd)) (ll '()) (rb 53)) (if (< rb 0) (cons (÷ r Nd) ll) (let* ((nq (ls r -54)) (R (- (ls r M) (* Nd nq)))) ; The expression (R (- (ls r M) (* Nd nq))) must be further analyzed by cases of bits in r. (rlp R (cons nq ll) (- rb M))))))) (dlp (+ j 1) (if maxlst (map max maxlst nl) nl))))))