(define eoml '(31 28 31 30 31 30 31 31 30 31 30 31)) (define ds (iota 31 1)) (define (sum-digit x) (if (< x 10) x (+ (div x 10) (mod x 10)))) (define sdodl (map (^ (x) (sum-digit x)) ds)) (define (days-of-month i) (car (drop eoml i))) (define (sdod i) (take sdodl (days-of-month i))) (define (count-hds i) (length (filter (^ (x) (= x (+ i 1))) (sdod i)))) (let loop ([i 0] [s 0]) (if (= i 12) (format #t "~d~%" s) (loop (+ i 1) (+ s (count-hds i)))))