mfikes / ambly

ClojureScript REPL into embedded JavaScriptCore
http://ambly.fikesfarm.com
Eclipse Public License 1.0
541 stars 21 forks source link

Hang if stack overflow #78

Closed mfikes closed 9 years ago

mfikes commented 9 years ago

(This ticket is inspired by blog post of Stuart Sierra.)

(defn next-results
  "Placeholder for function which computes some intermediate
  collection of results."
  [n]
  (range 1 n))

(defn build-result [n]
  (loop [counter 1
         results []]
    (if (< counter n)
      (recur (inc counter)
             (concat results (next-results counter)))
      results)))
cljs.user=> (first (build-result 4000))
RangeError: Maximum call stack size exceeded.

The stack overflow is reported, but the REPL then hangs.