Fork me on GitHub
#clojurescript
<
2019-11-06
>
johnj00:11:18

any reason this commands doesn't return a repl? clj -m cljs.main -H '0.0.0.0' -p 8080 -ro '{:launch-browser false}' -c hello-world.core -r

dnolen01:11:32

@lockdown- you can't use -c together with -r

dnolen01:11:10

oh hrm, I guess you can, I keep forgetting we tweaked that to work together - do you see any errors in the browser JS console?

dnolen01:11:33

(also I'm assuming this works for you if you don't use any of the options)

johnj01:11:21

took out the port flag and used default port 9000

johnj01:11:01

this is from a remote browser btw, hence the flags

edward.scott11:11:59

Can anyone point me at a compare function that can be used to to sort mixed types?

edward.scott11:11:32

I am looking to compare strings, numbers, booleans and keywords.

edward.scott12:11:59

Something along the lines of (defn safe-compare [x y] (if (or (identical? (type x) (type y)) (and (number? x) (number? y))) (compare x y) (let [type-preced #(cond (number? %) 0 (string? %) 1 (boolean? %) 2 (keyword? %) 3 :else 4)] (< (type-preced x) (type-preced y)))))

mfikes12:11:17

@lockdown- You should be able to override that by adding -co '{clojure.browser.repl/HOST "my-host"}' to your command line

p4ulcristian13:11:39

Hello guys, I try to make react-beautiful-dnd work with shadow-cljs but it doesn’t seem to work. I imported react-flatpickr that worked fine.

p4ulcristian14:11:58

Okay, I found my solution, for anyone wandering around like myself, here is the solution: https://github.com/atlassian/react-beautiful-dnd/issues/427#issuecomment-420563943

dnolen14:11:45

@lockdown- @mfikes and I believe that's actually done

souenzzo15:11:25

there is some cljs.core function equivalent to js/Array.from ?

herald09:11:26

Which aspect of js/Array.from do you want? I'd say seq is pretty close.

souenzzo13:11:43

I'm working with a wiredo JS object that (map f (js/Array.from x)) works but (map f (seq x)) dont I just wanna know if there is a idiomatic wrap like enumerator-seq or something like

herald15:11:43

ahh, I think (array-seq x 0) might work

herald15:11:34

You could also implement ISeqable so you're able to just (map f x)

(extend-type js/NodeList
  ISeqable
  (-seq [array] (array-seq array 0)))
Just replace js/NodeList with whatever weirdo JS type you're dealing with

johnj15:11:58

@mfikes @dnolen just tried that, the browser still tries to request the file from localhost

johnj15:11:01

btw, if a host is not specified, the web server still accepts remote connections

dnolen16:11:02

@lockdown- try removing your output directory and try again

johnj16:11:06

yeah, did that before trying the compiler option but requests from localhost

mruzekw17:11:12

Hi all, I’m trying to pretty print a piece of EDN but for some reason the CLJS compiler is saying pprint doesn’t exist:

(with-out-str (cljs.pprint/pprint {:foo 1}))

mruzekw17:11:52

Use of undeclared Var cljs.pprint/pprint

mruzekw17:11:14

What am I missing?

bfabry17:11:18

have you required cljs.pprint ?

mruzekw17:11:31

I should need to?

bfabry17:11:35

cljs.user=> (require '[cljs.pprint :as pprint])
nil
cljs.user=> cljs.pprint/pprint
#object[Function]

mruzekw17:11:41

Given I’m using a fully qualified name

bfabry17:11:47

yes. you need to require anything not in core

bfabry17:11:12

welll... it's way more complicated than that. but that's the way to think about clojure namespaces at least

mruzekw17:11:16

kk, thanks

mruzekw17:11:50

Is there a good resource for clj -> cljs ns and fn mapping?

dnolen19:11:18

@mruzekw not really, but it's not needed we auto-alias them anyway

dnolen19:11:29

require clojure.pprint will just load cljs.pprint

mruzekw19:11:37

Oh! That’s neat

mruzekw19:11:45

Thanks for the tip

dnolen19:11:57

@lockdown- it's possible it's just a bug - the standard browser REPL is mostly used for testing, not quite enough there yet for serious development

dnolen19:11:24

whatever it is that you want to do you can definitely do with something like Figwheel which is much more mature due to the number of users

johnj20:11:34

@dnolen oh, I see, looks like the browser repl in cljs is a complex subject (compared to clojure). Using just --watch (and my own web server) and refreshing the browser has been enough for playing with cljs for now, will look into figwheel next.

johnj20:11:01

is --watch considered reliable? 😉

dnolen20:11:43

unlikely to change, works ok - not quite as fancy as Figwheel again

johnj21:11:37

How would I go about doing incremental compilation manually? (without watch)

kwladyka23:11:10

Can somebody share Selenium tests for cljs? What library do you use? Do you recommend something else, than selenium? Do you even code this tests in cljs? I did research about this a long time ago. I am not up to date.