Fork me on GitHub
#clojurescript
<
2021-09-30
>
dnolen15:09:59

@johanatan it seems fine, but the patch does not have a test

ūüĎć 1
maverick16:09:39

When adding

:infer-externs true
in project.clj compiler it is caching API response.

vlad_poh16:09:23

how do i replace values in a javascript array with a clojurescript vector? I can loop through but before I do wanted to know if i was overlooking something

p-himik16:09:13

Not certain what you mean. Can you give an example input and an example output?

vlad_poh16:09:03

using chart.js and trying to update the dataset (.fill (.-data (first (.-datasets (.-data js/window.mbc)))) (map :active_customers data)) (.push (.-data (first (.-datasets (.-data js/window.mbc)))) (map :active_customers data)) Neither works

p-himik16:09:51

That's also not what I asked for. Your code has neither explicit arrays nor vectors.

vlad_poh16:09:52

(map :active_customers data) returns (0 0 0 0 0 0 0 1 2 0 0 0) (.fill ..... ) has (0 0 0 0 0 0 0 0 0 0 0 0 (0 0 0 0 0 0 0 1 2 0 0 0)) shows nothing (.set! ....) has (0 0 0 0 0 0 0 1 2 0 0 0) shows nothing

p-himik16:09:12

So the library expects a JS array and you have a CLJS sequence which you need to turn into that array?

p-himik16:09:22

Use into-array. An advice on how to approach such things in the future - launch REPL (CLJS in this case, not CLJ) and just execute (apropos array) - it will show you all core functions that include the word "array" in their name.

ūüôŹ 1
vlad_poh17:09:49

into-array worked!!! thank you @U2FRKM4TW

ūüĎć 1
vlad_poh17:09:09

my setup is horrible! so first i converted all my html to hiccup then I embedded scittle.js into the page and I've started converting my javascript to clojurescript

p-himik17:09:24

Well, hope you get there. :)

vlad_poh17:09:37

does it make sense to use clojurescript if your app is not a SPA?

p-himik17:09:27

If it makes sense to use JS there, then it makes sense to use CLJS.

ūüĎć 1
dnolen17:09:54

@anshbenew that seems pretty weird, I don't see how those are related - probably something else is going on

ūüĎć 1