Project Euler 8 in Scheme

@timgallant

;; helpers


(define (num->list num)
  (if (< num 10)
      (list num)
      (append (num->list (floor (/ num 10)))
              (list (- num (* 10 (floor (/ num 10))))))))

;; e8

(define (e8 n)
  (define (e8-inner x)
    (let ((i (apply * (take 13 (from x n)))))
      (if (< x 987)
          (cons i (e8-inner (+ x 1)))
          '())))
  (e8-inner 0))

(apply max (e8 (num->list big-num)))