This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (3)
- # boot (205)
- # cider (41)
- # clojars (1)
- # clojure (76)
- # clojure-colombia (1)
- # clojure-dusseldorf (3)
- # clojure-russia (314)
- # clojure-sg (1)
- # clojurebridge (1)
- # clojurescript (115)
- # css (2)
- # cursive (5)
- # editors (2)
- # funcool (2)
- # hoplon (18)
- # jobs (62)
- # jobs-discuss (28)
- # ldnclj (1)
- # leiningen (10)
- # mount (9)
- # off-topic (4)
- # om (93)
- # parinfer (10)
- # proton (1)
- # re-frame (19)
- # ring-swagger (18)
@venantius: if you know it is a record,
(pr-str (type (atom 5))) yields
can someone help me configure my dev server so that it picks up changes I make on the backend. I'm using figwheel and including the ring handler in figwheels 'ring-handler' option. I'm wrapping the handler using wrap-reload and its still not working. ..
How can one take a string like "file.extension" and return ".extension"? I.E.: How does one get the extension of a filename in cljs?
@venantius: if you want to detect if something is a record, you can see if it satisfies or implements
IRecord but if it is a
deftype perhaps you have to resort to seeing if you can call
getBasis and seeing if it returns a vector. (Maybe there's a clever way…)
just need to check that .-name isn’t the empty string instead of the pure boolean check
I just found, that in Planck I can do things like (+ 3/2 5/4) ... I was under the impression, that fractional numbers are/were not supported under Clojurescript - is this a misunderstanding on my side?
when I try this in regular Clojurescript, I get "java.lang.IllegalArgumentException : No method in multimethod 'emit-constant' for dispatch value: class clojure.lang.Ratio" , as I would expect
Yeah, there is no ratio support in ClojureScript. In Planck you’re just get plain JS number back.
But you’re right, this is behaving differently in plain ClojureScript and Boostrapped ClojureScript
I don’t know if it’s Planck though. For example, you get the same result in something like http://clojurescript.io
I don’t know the details either. I’m sure he knows more about the reason for the difference.
So, even in regular ClojureScript, without ratio support,
(/ 2) is
0.5. I suppose the only difference is this odd one with the reader. The JVM compiler could perhaps be updated to emit double literals for
clojure.lang.Ratio. Wonder if pros/cons have been debated.
I once asked David Nolen on irc, if ratios would be supported sometime, but he said this wouldn't make much sense, JS not having sensible support - but this reader solution would be n intermediate solution, a quite nice one
@solicode: @mmeix: Interestingly, adding support for literals like
3/4 is truly one line. But, it is not possible to properly deal with
0/0, and the two infinities (forms like
-1/0) because the ratio is formed in Clojure.
@mmeix: It boils down to a decision by humans, not a technical problem. ClojureScript uses both
tools.reader variants. The question would be whether it was deemed worth it to have the Clojure version of
@mmeix: Another way to look at is to consider
(/ 0) in both Clojure and ClojureScript.
Yeah, if someone is interested in pursuing it, it would amount to hopping in #C07UQ678E and/or writing patches and garnering support / agreement that it is worth it. (And probably doing the same for
The easy part is easy Duplicate this
BigInt line for
Ratio. But the
-Infinity are the hard bits.
The hard part, IMHO, is the fact that it touches on what the language should do, and whether consensus is possible to achieve.
maybe I'll try tomorrow, as an exercise, with a fresh mind ... exercise always a good thing
Has anyone tried bootstrapped Clojurescript on PhantomJS? I'm trying to run some unit test, and getting a PhantomJS crash when I try
@mfikes: That's an interesting bug.
:static-fns true doesn't seem to affect it, so probably not the same thing.
@ctford: Cool. There are two places you could set
:static-fns true: 1) When you are building everything with JVM ClojureScript, and 2) When you are compiling a form with bootstrap ClojureScript. Either one might be needed.
@ctford: FWIW, I found that, to run
cljs.test in Planck, this was needed. My guess is that the
@mfikes: Wait, you're right! I'd only added the flag to the boostrapped compiler options. Adding it to the JVM compiler options too allows the test to run.
@mfikes: Your theory about it being related to
is helps me understand why I hadn't encountered it for production code.