deuglyfied racket solution for problem 1
This commit is contained in:
parent
3872593d2f
commit
eae9b67bac
1 changed files with 6 additions and 9 deletions
15
1/euler1.rkt
15
1/euler1.rkt
|
@ -1,10 +1,7 @@
|
|||
#lang racket
|
||||
#lang typed/racket
|
||||
|
||||
(define (multiples limit)
|
||||
(foldl + 0 (filter (lambda (x) (cond
|
||||
[(= 0 (remainder x 3)) #t]
|
||||
[(= 0 (remainder x 5)) #t]
|
||||
(else #f)))
|
||||
(range limit))))
|
||||
|
||||
(multiples 1000)
|
||||
(foldl (λ ((x : Nonnegative-Integer)
|
||||
(y : Nonnegative-Integer))
|
||||
(if (or (zero? (remainder x 3))
|
||||
(zero? (remainder x 5)))
|
||||
(+ x y) y)) 0 (range 1 1000))
|
Reference in a new issue