clojurescript

2024-12-16T03:36:49.100039Z

when i create a new reagant project with lein i get the following error Cannot read properties of undefined (reading 'render')...if made zero edits to the project that is generated. anyone else encounter this?

liebs 2024-12-16T04:52:33.489669Z

Did you install react?

2024-12-17T22:22:00.341589Z

yes i see it in my node_modules

2024-12-17T22:22:18.732939Z

2024-12-17T22:22:20.765739Z

[reagent "1.1.1"]
[reagent-utils "0.3.4"]
[cljsjs/react "17.0.2-0"]
[cljsjs/react-dom "17.0.2-0"]

liebs 2024-12-18T00:10:09.120749Z

I would avoid using cljsjs and install using npm directly

itaied 2024-12-16T06:13:55.407399Z

clj

(/ 100 3) => 100/3 Ratio type
cljs
(/ 100 3) => 33.333 Number type
what is the reason behind this disparity?

Macroz 2024-12-16T06:15:45.908849Z

I think the reasoning is • Because a rational type does not exist in JavaScript. • It would be kind of slow to emulate one. See differences here https://clojurescript.org/about/differences#_the_reader

itaied 2024-12-16T06:17:32.084849Z

hi thanks i have read the differences page but there is no explanation there in java there is no ratio as well, it's under the clojure.lang.Ratio so is it just because performance wise? why is it more critical in js?

Macroz 2024-12-16T06:19:47.988559Z

Overall Clojure is a hosted language. So the most popular concepts that the hosting environment has should be accessible. JavaScript doesn't have one so I guess it made the initial porting effort easier.

Macroz 2024-12-16T06:22:16.754809Z

I don't know. I see the Clojure implementation being in the tradition of other lisps. I tend to avoid rationals because I usually just need the fastest floating point numbers. Java does have BigDecimal and BigInteger so maybe it seemed like a good addition 🤷

Macroz 2024-12-16T06:23:09.322489Z

clojure.lang.Ratio is implemented in terms of those Java classes so it'll be easier there.

lassemaatta 2024-12-16T06:24:55.895639Z

There's an ask clojure question about this plus a ticket; https://ask.clojure.org/index.php/5887/clone-implement-ratios

👍 2
daveliepmann 2024-12-16T08:37:19.007069Z

I was kind of surprised to see "Hosted on the JVM" on https://clojurescript.org/about/differences – I guess it's strictly following the "section-by-section" comparison to http://clojure.org

souenzzo 2024-12-23T16:29:28.430889Z

I think that the cljs reader could accept 3/4 and emit (3/4)