Advertisement
Guest User

Untitled

a guest
Dec 26th, 2011
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn three-or-five [num]
  2.   (if (== (mod num 5) 0)
  3.     5
  4.     (if (== (mod num 3) 0)
  5.       3
  6.       0)))
  7.  
  8. (defn produce-list [range]
  9.   (loop [current 0, total 0]
  10.     (if (== current range)
  11.       total
  12.       (recur (+ current 1) (+ total (three-or-five current))))))
  13.  
  14. (def num-total (produce-list 1000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement