mes: Bugifx for number->string radix > 10.

* module/mes/scm.mes (number->string): Bugfix for `10' -> hex/radix > 10.
This commit is contained in:
Jan Nieuwenhuizen 2017-05-23 06:28:37 +02:00
parent 21aff4c7ad
commit bdd160241b

View file

@ -252,7 +252,7 @@
(sign (if (< n 0) '(#\-) '()))) (sign (if (< n 0) '(#\-) '())))
(let loop ((n (abs n)) (lst '())) (let loop ((n (abs n)) (lst '()))
(let* ((i (remainder n radix)) (let* ((i (remainder n radix))
(lst (cons (integer->char (+ i (if (<= i 10) (char->integer #\0) (lst (cons (integer->char (+ i (if (< i 10) (char->integer #\0)
(- (char->integer #\a) 10)))) lst)) (- (char->integer #\a) 10)))) lst))
(n (quotient n radix))) (n (quotient n radix)))
(if (= 0 n) (list->string (append sign lst)) (if (= 0 n) (list->string (append sign lst))