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

Showing 1-6 of 6 messages
Simple expression that evaluates to 21 in clojure but crashes in clojurescript rumate 9/3/13 11:48 AM
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..

Re: Simple expression that evaluates to 21 in clojure but crashes in clojurescript rumate 9/4/13 12:06 AM
Made a new refheap poste; (cljs-ok) should be equivalent to (cljs-ouch) and runs fine: https://www.refheap.com/18283
Re: Simple expression that evaluates to 21 in clojure but crashes in clojurescript rumate 9/5/13 2:11 AM
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
Re: Simple expression that evaluates to 21 in clojure but crashes in clojurescript rumate 9/9/13 12:56 AM
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
Re: Simple expression that evaluates to 21 in clojure but crashes in clojurescript rumate 9/9/13 11:09 PM
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
Re: [ClojureScript] Re: Simple expression that evaluates to 21 in clojure but crashes in clojurescript David Nolen 9/9/13 11:22 PM
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.