Comment detail

LL Golf Hole 5 - 最上位の桁を数え上げる (Nested Flatten)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(use srfi-1)
(define (main args)
  (let ((n (string->number (cadr args))))
    (print 0)
    (let loop ((i 1))
      (receive (xs ys) (partition (cut <= <> n)
                                  (map (cut * i <>) '(1 2 3 4 5 6 7 8 9)))
        (for-each print xs)
        (if (pair? ys)
            0
            (loop (* i 10)))))))

Index

Feed

Other

Link

Pathtraq

loading...