This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-10
Channels
- # adventofcode (3)
- # aws (2)
- # beginners (85)
- # boot (8)
- # boot-dev (4)
- # cider (36)
- # clara (3)
- # cljs-dev (87)
- # cljsrn (3)
- # clojure (87)
- # clojure-austin (12)
- # clojure-brasil (1)
- # clojure-dev (8)
- # clojure-dusseldorf (5)
- # clojure-estonia (5)
- # clojure-greece (4)
- # clojure-italy (3)
- # clojure-spec (17)
- # clojure-uk (55)
- # clojurescript (70)
- # core-logic (2)
- # cursive (6)
- # data-science (18)
- # datomic (13)
- # emacs (34)
- # fulcro (347)
- # graphql (12)
- # hoplon (6)
- # jobs (3)
- # jobs-discuss (43)
- # juxt (2)
- # keechma (31)
- # leiningen (29)
- # lumo (2)
- # midje (2)
- # off-topic (118)
- # om-next (4)
- # onyx (39)
- # pedestal (6)
- # re-frame (85)
- # reagent (21)
- # remote-jobs (3)
- # ring (5)
- # rum (2)
- # shadow-cljs (126)
- # spacemacs (1)
- # sql (6)
I’m getting a reader error w/ the ##Inf
tag in :
Compile sources, elapsed time: 1069.79432 msecs
clojure.lang.ExceptionInfo: failed compiling file:resources/test/env/test/cljs/core.cljs {:file #object[java.io.File 0x52c46116 "resources/test/env/test/cljs/core.cljs"]}
at clojure.core$ex_info.invokeStatic(core.clj:4739)
...
Caused by: clojure.lang.ExceptionInfo: No reader function for tag Inf {:type :reader-exception, :line 988, :column 14, :file "file:/Users/tianxiang.xiong/.m2/repository/org/clojure/clojurescript/1.9.946/clojurescript-1.9.946.jar!/cljs/core.cljs"}
...
Even though I have an explicit dependency on tools.reader 1.1.1
, as lein deps :tree
confirms.
Anyone else encounter this problem?how does
(. js/console log (str ::foobar))
work correctly given that cljs has no notion of namespaces ?The js
namespace is given special treatment
let me rephrase why does ::foobar
resolve correclty into some.name.space/foobar
given cljs has no notion of namespaces
what is something that I can do with 'notion of namepsace ar runtime' that I can not do with 'notion of namespace at compiletime' ? calling ns-resolve ?
i never much investigated runtime ns support, it only makes sense that we couldn't even compile a project without that notion at compile time
Hi, does anyone use clojurescript with d3
? I found d3
do some not immutable operations like in this example: https://bl.ocks.org/mbostock/3883245 x.domain(d3.extent(data, function(d) { return d.date; }));
set x
Axis's domain, I am working on a project which need to do some similiar work. I found there are some errors prevents generating the axis. How this can be achieved in clojurescript?
@cmal d3 only supports JS objects/arrays. if you pass a clojure vector or so as data
that won’t work
don’t need the ^js
annotations in lines 14,15,10 if you do it in line 8, probably need it on (fn [^js d] (.-div...))
though
@thheller OK. Am I right about the (dividend-x-set-domain ^js data)
? I am wondering whether should I use the previous (dividend-x)
or (dividend-x-set-domain ^js data)
's return value when do something like js's .call(d3.axisBottom(x))
.
you only need the ^js
tag an anything that does JS interop at places where the interop actually occurs
@thheller Should I use clj->js
in (.axisLeft d3 (clj->js (dividend-y)))
when passing a function to some d3 method like .axisLeft
? (dividend-y defined just likes before.)
And should I wrap fn
in clj-js
in
(def dividend-line
(-> d3
.line
(.x (fn [^js d] ((dividend-x) (parse-time (.-date d)))))
(.y (fn [^js d] ((dividend-y) (.-divirate d))))))
?I don’t understand the question. You only need to call clj->js
whenever you have a CLJS object but want a JS object, never when you already have a JS Object
when you call a d3
fn you never get a CLJS object back so you never need to call clj->js
on any of these
depending on how many JS objects you use you may be better of only using JS objects as well.
I thought the (fn [^js d] ((dividend-x) (parse-time (.-date d)))
is not called when passed to d3.line.x()
. So should wrap in a clj->js
? 😕
Hi, we've just noticed that that app.js
compiled for production has snippets of code that are not minimized (libs like moment.js, react-dom from http://cljsjs.github.io).
from here I understand that those libs get through the stage of google closure compiler
no, your code goes through the compiler and it needs to know what the foreign libs do
I am using haslett
for websockets. When I try to connect to a WS endpoint which throws 500 I get an error at this line
(js/WebSocket. url)
Error is expected in this scenario.
But I am not able to catch this error. I tried
(try (ws/connect url)
(catch :default e
(js/console.log "Failed to connect to ws! " e)))
and
(try (ws/connect url)
(catch js/Object e
(js/console.log "Failed to connect to ws! " e)))
None of these two catch the error@rnagpal JS is pretty much all async, you probably want to listen to the error
event
if i’m writing a blog post targeted at people who don’t know clojure/script, and i’ve got these sentences (among others) in the beginning of my clojurescript section: ClojureScript is a dialect of Clojure that compiles to JavaScript. ClojureScript lets you write a Clojure program and then run it in a web browser. is that second sentence fine, or is it misleading/inaccurate somehow?
i originally qualified it with “ClojureScript essentially lets you write a Clojure program and then run it in a web browser”, but removed the “essentially” because i didn’t like how it looked. should i add it back, or is the sentence fine without it?
@jrheard it’s not really about browsers (though that’s a major usecase), it’s about running where JavaScript can run (i.e. where JVM isn’t viable or less suited for some reason)
@rnagpal That catch should work (and the websocket library definitely throws exceptions and haslett doesn’t seem to catch them for you unfortunately). Are you sure that’s the right line? You said in your comment that the exception was being thrown on (js/WebSocket. url)
but then you showed a try block around (ws/connect url)
The :npm-deps
story (https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules) doesn't seem to be complete. Is there a more complete tutorial, perhaps for lein-cljsbuild/figwheel?
@lee.justin.m Thanks for the reply. Actually I was wrong. Javascript doest throw an error when we get 500 on WS connect URL
really? you shouldn’t. i’m pretty sure the websocket interface promises to call onclose whenever onerror is called, even on connection failure
onclose should too. so you should be able to look at code
and reason
in the promise chan returned by haslett
@lee.justin.m thanks. You are correct. That is called too