Skip to content

Instantly share code, notes, and snippets.

Created September 30, 2013 14:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6764863 to your computer and use it in GitHub Desktop.
Save anonymous/6764863 to your computer and use it in GitHub Desktop.
#lang typed/racket
(: div-by (Integer Integer -> Boolean))
(define (div-by y x)
(eq? (modulo x y) 0))
(: div-by-3-or-5 (Integer -> Boolean))
(define (div-by-3-or-5 x)
(or (div-by 3 x) (div-by 5 x)))
(: euler1 (Integer -> Integer))
(define (euler1 n)
(foldl + 0 (filter div-by-3-or-5 (range n))))
(euler1 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment