Advertisement
Guest User

Untitled

a guest
Sep 19th, 2010
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1.  
  2. (defn r-squared [x y]
  3. (+ (* (- 0.5 x) (- 0.5 x))
  4. (* (- 0.5 y) (- 0.5 y))))
  5.  
  6. (loop [hits 0]
  7. (let [x (rand)
  8. y (rand)]
  9. ; still inside the let
  10. (if (< (r-squared x y) 0.25)
  11. (println "true") ; then expression, restarts the loop
  12. (println "false")))) ; else-expression, the return value of the loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement