StackOverflowError on tail-recursive function
问题 The following piece of Clojure code results in java.lang.StackOverflowError when I call it with (avg-bids 4000 10 5). I try to figure out why, since sum-bids is written as a tail-recursive function, so that should work. Using Clojure 1.2. Anyone knows why this happens? (ns fixedprice.core (:use (incanter core stats charts))) (def *bid-mean* 100) (defn bid [x std-dev] (sample-normal x :mean *bid-mean* :sd std-dev)) (defn sum-bids [n offers std-dev] (loop [n n sum (repeat offers 0)] (if (zero?