;; (remap val '(-1 1) '(0 255)) (define (remap value source target) (let ((source-low (car source)) (source-high (cadr source)) (target-low (car target)) (target-high (cadr target))) (inexact->exact (truncate (+ target-low (* (- target-high target-low) (/ (- value source-low) (- source-high source-low))))))))