aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2008-06-08 00:14:14 +0000
committerscgilardi <scgilardi@gmail.com>2008-06-08 00:14:14 +0000
commitfd93736c15dd0c03e73b4f9589f17a9edbac873e (patch)
tree360b25691f1fca0805951b54f467603dce916978
parent28a7f0d52d8b6466c58c549f5b593dd2ab8041ff (diff)
fix tabs in lazy-seqs.clj
-rw-r--r--lazy-seqs.clj26
1 files changed, 13 insertions, 13 deletions
diff --git a/lazy-seqs.clj b/lazy-seqs.clj
index 97f67156..3d57033f 100644
--- a/lazy-seqs.clj
+++ b/lazy-seqs.clj
@@ -15,7 +15,7 @@
;; 7 from consideration by incrementing past them. Also inspired
;; by code from Christophe Grand in [2].
;;
-;; fib - based on code from Rich Hickey at the Clojure wiki [3]
+;; fib - based on code from Rich Hickey at the Clojure wiki [3]
;;
;; [1] http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
;; [2] http://clj-me.blogspot.com/2008/06/primes.html
@@ -32,21 +32,21 @@
(defvar primes
(lazy-cat [2 3 5 7]
(let [primes-from
- (fn primes-from [n [f & r]]
- (if (some #(zero? (rem n %)) (take-while #(<= (* % %) n) primes))
- (recur (+ n f) r)
- (lazy-cons n (primes-from (+ n f) r))))
- wheel (cycle [2 4 2 4 6 2 6 4 2 4 6 6 2 6 4 2
- 6 4 6 8 4 2 4 2 4 8 6 4 6 2 4 6
- 2 6 6 4 2 4 6 2 6 4 2 4 2 10 2 10])]
- (primes-from 11 wheel)))
+ (fn primes-from [n [f & r]]
+ (if (some #(zero? (rem n %)) (take-while #(<= (* % %) n) primes))
+ (recur (+ n f) r)
+ (lazy-cons n (primes-from (+ n f) r))))
+ wheel (cycle [2 4 2 4 6 2 6 4 2 4 6 6 2 6 4 2
+ 6 4 6 8 4 2 4 2 4 8 6 4 6 2 4 6
+ 2 6 6 4 2 4 6 2 6 4 2 4 2 10 2 10])]
+ (primes-from 11 wheel)))
"A lazy sequence of all the prime numbers.")
(defvar fib
(concat [0 1]
(let [rest-fn
- (fn rest-fn [a b]
- (let [next (+ a b)]
- (lazy-cons next (rest-fn b next))))]
- (rest-fn 0 1)))
+ (fn rest-fn [a b]
+ (let [next (+ a b)]
+ (lazy-cons next (rest-fn b next))))]
+ (rest-fn 0 1)))
"A lazy sequence of all the fibonacci numbers.")