Comment detail

アルファベットの繰り上がり (Nested Flatten)
gauche
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
(use srfi-1)
(define (alphabets n)
  (define (alph m) (ucs->char (- (+ (char->ucs #\A) m) 1)))
  (let ((a2 (quotient (- n 1) 26))
        (a1 (+ 1 (remainder (- n 1) 26))))
    (if (zero? a2)
      (string (alph a1))
      (string (alph a2) (alph a1)))))
    

(map
 (lambda (x) (format #t "~s " (alphabets x)))
 (iota 100 1))

Index

Feed

Other

Link

Pathtraq

loading...