Posting this in case someone else finds themselves in a similar situation:
I'm working on a project using self-hosting ClojureScript, modeling my code
after KLIPSE[0]. I tried entering this code:
(if (> 20 10) 5 6)
and got this compiled JavaScript:
if(((20) > (10))){
}
else {
}
and null as the JavaScript output.
However, when I tried it in a ClojureScript web repl[1], Jared Forsyth's
reepl[2], and clojurescript.net[3], it worked as expected, evaluating to 5.
It turns out that the latter sites all set {:context :expr} when they call
cljs/eval-str; KLIPSE and I don't.
If you set {:context :expr}, then you can't do code like the following in a
multi-line text area; it generates a "missing ; before statement" error.:
(def x 12)
(+ x 5)
[0] http://blog.klipse.tech/clojure/2016/03/17/klipse.html
[1] http://chimeces.com/cljs-browser-repl/
[2] https://jaredforsyth.com/reepl/
[3] http://clojurescript.net/
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.