Simple expression that evaluates to 21 in clojure but crashes in clojurescript

238 views
Skip to first unread message

rumate

unread,
Sep 3, 2013, 2:48:13 PM9/3/13
to clojur...@googlegroups.com
Evaluating (clsj-ouch) produces a stackoverflow-like error in my inferior-lisp buffer:

https://www.refheap.com/18265

The code is inspired by Würfelbohnanza: http://boardgamegeek.com/image/1210283/wurfel-bohnanza. It filters all combinations in a certain cartesian product by some predicate function.

The problem seems to have something to do with lazy-seq, which is used in combinatorics/cartesian-product and find. The stack tracke consists of these lines, repeated many times:

cljs.core.LazySeq.prototype.cljs$core$ISeqable$_seq$arity$1@http://localhost:3000/js/main-debug.js:8898
_seq@http://localhost:3000/js/main-debug.js:3475
seq@http://localhost:3000/js/main-debug.js:4410


My inferior-lisp-program is: "lein trampoline cljsbuild repl-listen".

Cheers..

rumate

unread,
Sep 4, 2013, 3:06:29 AM9/4/13
to clojur...@googlegroups.com
Made a new refheap poste; (cljs-ok) should be equivalent to (cljs-ouch) and runs fine: https://www.refheap.com/18283

rumate

unread,
Sep 5, 2013, 5:11:16 AM9/5/13
to clojur...@googlegroups.com
On Tuesday, September 3, 2013 8:48:13 PM UTC+2, rumate wrote:
Let predicate = (is-roll-has-colours? (list :red :red :red :green :green :green)), then it seems that this expression causes "too much recursion" error in firefox:

(first (filter predicate (all-rolls)))

while this one doesn't:

(some #(when (predicate %) %) (all-rolls))

so maybe there's something wrong with filter?

see https://www.refheap.com/18346

rumate

unread,
Sep 9, 2013, 3:56:46 AM9/9/13
to clojur...@googlegroups.com
On Tuesday, September 3, 2013 8:48:13 PM UTC+2, rumate wrote:
The following also causes "too much recursion" error in firefox:

(first (filter #(= 9999 %) (range)))

while this expression evaluates to 9999:

(some #(when (= 9999 %) %) (range))

see https://www.refheap.com/18468

rumate

unread,
Sep 10, 2013, 2:09:04 AM9/10/13
to clojur...@googlegroups.com
On Tuesday, September 3, 2013 8:48:13 PM UTC+2, rumate wrote:
There is now a JIRA ticket for this: http://dev.clojure.org/jira/browse/CLJS-587

David Nolen

unread,
Sep 10, 2013, 2:22:44 AM9/10/13
to clojur...@googlegroups.com
Thanks for the report, will look into it!



--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply all
Reply to author
Forward
0 new messages