a-conjecture-of-mine

An exercise on polyglossy: the same problem solved on multiple languages

Commit
c7b51a4bfe125e03fc7371e24a1da56568acb925
Parent
f00a25dbba8a5949c25ded19c8df75f874e91076
Author
Pablo Escobar Gaviria <gark.garcia@protonmail.com>
Date

Formatted the Racket implementation.

Diffstat

1 file changed, 6 insertions, 6 deletions

Status File Name N° Changes Insertions Deletions
Modified script.rkt 12 6 6
diff --git a/script.rkt b/script.rkt
@@ -24,12 +24,12 @@
     (let ([sum (lambda (n) (vector-ref sums-cache n))])
          (zero? (remainder (- (sum (+ a b)) (sum a) (sum b)) 9))))
 
-(define (sum-digits n) (sum-digits-tail n 0))
-
-(define (sum-digits-tail n acc)
-    (if (zero? n)
-        acc
-        (sum-digits-tail (quotient n 10) (+ acc (remainder n 10)))))
+(define (sum-digits n) 
+    (define (sum-digits-tail n acc)
+        (if (zero? n)
+            acc
+            (sum-digits-tail (quotient n 10) (+ acc (remainder n 10)))))
+    (sum-digits-tail n 0))
 
 (define (get-sums max) (build-vector (+ (* 2 max) 1) sum-digits))