Hi Kyle!

I encountered the same problem:

(defn stack-fail
  "returns an empty lazy seq"
  [l i]
  (if (> i 0)
    (recur (remove #{1} (concat l '(1))) (dec i))
    l))

(def foo (stack-fail () 1000))

foo
; Evaluation aborted.

if you call a non-lazy function (e.g. doall) on the collection from
time to time this wont happen.

Rgds, Robert

On 15 Jan., 00:05, mudphone <kyle...@gmail.com> wrote:
> Is it possible that the Clojure core seq function can cause a stack
> overflow (since it calls itself)?
>
> Or is there some other manner in which misuse of a lazy seq could
> cause this?  In the stack trace below, I'm seeing repeated calls to
> "seq" in clojure core, until the stack is blown.
>
> Thanks,
> Kyle
>
> Exception in thread "main" java.lang.StackOverflowError
> (session_master_boot.clj:19)
>         at clojure.lang.Compiler.eval(Compiler.java:4617)
>         at clojure.lang.Compiler.eval(Compiler.java:4593)
>         at clojure.lang.Compiler.load(Compiler.java:4931)
>         at clojure.lang.Compiler.loadFile(Compiler.java:4898)
>         at clojure.main$load_script__6637.invoke(main.clj:210)
>         at clojure.main$init_opt__6640.invoke(main.clj:215)
>         at clojure.main$initialize__6650.invoke(main.clj:243)
>         at clojure.main$null_opt__6672.invoke(main.clj:268)
>         at clojure.main$legacy_script__6687.invoke(main.clj:299)
>         at clojure.lang.Var.invoke(Var.java:359)
>         at clojure.main.legacy_script(main.java:32)
>         at clojure.lang.Script.main(Script.java:20)
> Caused by: java.lang.StackOverflowError
>         at clojure.core$seq__3835.invoke(core.clj:103)
>         at clojure.core$concat__3960$fn__3970.invoke(core.clj:427)
>         at clojure.lang.LazySeq.sval(LazySeq.java:42)
>         at clojure.lang.LazySeq.seq(LazySeq.java:56)
>         at clojure.lang.RT.seq(RT.java:440)
>         at clojure.core$seq__3835.invoke(core.clj:103)
>         at clojure.core$concat__3960$fn__3970.invoke(core.clj:427)
>         at clojure.lang.LazySeq.sval(LazySeq.java:42)
>         at clojure.lang.LazySeq.seq(LazySeq.java:56)
>         at clojure.lang.RT.seq(RT.java:440)
>         at clojure.core$seq__3835.invoke(core.clj:103)
>         at clojure.core$concat__3960$fn__3970.invoke(core.clj:427)
>         at clojure.lang.LazySeq.sval(LazySeq.java:42)
>         at clojure.lang.LazySeq.seq(LazySeq.java:56)
>         at clojure.lang.RT.seq(RT.java:440)
>         at clojure.core$seq__3835.invoke(core.clj:103)
>         at clojure.core$concat__3960$fn__3970.invoke(core.clj:427)
>         at clojure.lang.LazySeq.sval(LazySeq.java:42)
>         at clojure.lang.LazySeq.seq(LazySeq.java:56)
>         at clojure.lang.RT.seq(RT.java:440)
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to