Mercurial > rlm
diff src/rlm/scratch.clj @ 0:78a630e650d2
initial import
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 18 Oct 2011 00:57:08 -0700 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/rlm/scratch.clj Tue Oct 18 00:57:08 2011 -0700 1.3 @@ -0,0 +1,35 @@ 1.4 +(ns rlm.scratch) 1.5 + 1.6 + 1.7 + 1.8 +(defn n-sqrt 1.9 + ([num] (n-sqrt num 1)) 1.10 + ([num guess] 1.11 + (cond 1.12 + (< (abs (- num (* guess guess))) 1e-6) 1.13 + (double guess) 1.14 + :t 1.15 + (n-sqrt num (/ (+ (* guess guess) num) 2 guess))))) 1.16 + 1.17 + 1.18 + 1.19 + 1.20 + 1.21 + ;; (= 0 1.22 + ;; (+ (* 2 guess new-guess) ( - (* guess guess) num)) ) 1.23 + 1.24 + ;; (= (/ (+ (* guess guess) num) 2 guess) 1.25 + ;; (new-guess)) 1.26 + 1.27 + 1.28 + 1.29 + 1.30 +;; play some music 1.31 + 1.32 + 1.33 +(dorun 1.34 + (map #(sw (str "totem --enqueue \"" (.getCanonicalPath %) "\"")) 1.35 + (filter #(re-matches #".*Mega.*" (.getCanonicalPath %)) 1.36 + (file-seq (file-str "/home/r/Desktop/first-archive/sounds/Overclocked/"))))) 1.37 + 1.38 +