Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn r-squared [x y]
- (+ (* (- 0.5 x) (- 0.5 x))
- (* (- 0.5 y) (- 0.5 y))))
- (loop [hits 0]
- (let [x (rand)
- y (rand)]
- ; still inside the let
- (if (< (r-squared x y) 0.25)
- (println "true") ; then expression, restarts the loop
- (println "false")))) ; else-expression, the return value of the loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement