       ;; no match - next iteration
      :else (get-primes n (rest ps) acc))))
 
-(defn max-prime
-  "*Int, [Int] -> Int*
+(defn max-prime [n ps]
+  "**max-prime :: Int, [Int] -> Int**
   Given a number n and a list of prime numbers ps, returns the largest prime factor of n."
-  [n ps]
   ;; local variable - head of prime list
   (let [div (first ps)]
     (cond

                      (reduce nth grid yx))))))

(def primes
  "*[Int]*
  Lazy stream of prime numbers, generated by the sieve of Eratosthenes algorithm.
  Internally stores in a hastable the next composite number corresponding to the prime number.
  Taken from http://voidmainargs.blogspot.de/2010/12/lazy-sieve-eratosthenes-in-scala-and.html"

      :else (max-prime n (rest ps)))))

(defn prime-factors
  "** prime-factors :: Int -> [Int]**
Given a number, returns the list of prime factors of n.
Example: (prime-factors 12) => (2 2 3)"
  ([n] (prime-factors n [] primes))
