Fork me on GitHub
#clojurescript
<
2021-02-13
>
Carlo01:02:22

is there something like https://github.com/clojure/data.generators/ for clojurescript?

Carlo01:02:22

in the sense of an explicitly seedable random generation library?

datran02:02:53

There's an issue in CLJS that I'd like to signal my interest in, what's the best way to do that? I didn't see a way to register.

andy.fingerhut03:02:27

I know CLJ issue votes are examined there. I don't know whether ClojureScript devs look at them on http://ask.clojure.org or not.

andy.fingerhut03:02:07

I don't know if http://ask.clojure.org lets you be notified on changes or new comments on one of its issues.

Alex Miller (Clojure team)03:02:47

Most jiras should have a corresponding ask question

Alex Miller (Clojure team)03:02:16

If it doesn’t, feel free to make one and reference it

datran05:02:27

Thanks, I've registered and added an answer to the issue expanding the scope a little bit!

datran02:02:29

Or at least subscribe so I can see when there are updates

Carlo14:02:49

can I disable warnings from libreries I'm importing? I'm using loom in cljs, and there's always this warning:

------ WARNING #1 - :invalid-arithmetic ----------------------------------------
 Resource: loom/alg_generic.cljc:494:19
 cljs.core/bit-or, all arguments must be numbers, got [any Long] instead
--------------------------------------------------------------------------------
there's a patch at https://github.com/aysylu/loom/pull/125 but it hasn't been merged. I'd like to not see that warning when I use my repl

andy.fingerhut16:02:08

A general technique for making arbitrary changes to a library is to create your own fork, make whatever changes you want, and use that, perhaps publishing the result in a way that not only you but others could also use. That happens semi-often, and can lead to confusion for new users of the library which one to use, but it is very effective.

andy.fingerhut16:02:03

I don't know any ways to disable warnings for a single library. There may be hacks like filtering the output through some code that recognizes and removes the warnings you don't want to see, but that seems fragile and kludgy.

Carlo18:02:20

thanks @U0CMVHBL2, I'm still learning to use shadow, and so wasn't sure on how I could include a local fork from there. I also now know that this option fixes what I wanted in shadow:

:dev {:compiler-options {:warnings {:invalid-arithmetic false}}}

Carlo14:02:53

I'm doing :dev {:compiler-options {:invalid-arithmetic false}} in shadow-cljs.edn but maybe that doesn't work for subdependencies?

Milan Munzar19:02:05

Hey, 🙂 Do you know how to make a type based dispatch in ClojureScript. I.e. shorter version of:

(defmulti  foo (fn [x]
                 (cond
                   (fn? x) :function
                   (seq x) :sequence
                   :else :unsupported)))

(defmethod foo :function [_] (println "function"))
(defmethod foo :sequence [_] (println "sequence"))

Vincent Cantin23:02:37

Using cljs.analyzer.api/analyze-file , is there a way parse the source code without having the macro clojure.core/for expanded? My goal is to analyze the body of the for , and the macro expansion is making it very very difficult to find the body in the general case.

andy.fingerhut23:02:42

wild guess, which I've never tried and there might be very good reasons that it would not work -- redefine the for macro in some way that it will only affect your analyze-file call, so that the expansion of for is something easy for you to recognize, and leaves the input expression pretty much unchanged? e.g. you could expand it to something like (do :my-custom-magic-keyword-to-recognize-for-expansions ...) where the ... contains something where all of the original for subexpressions are there.

andy.fingerhut23:02:01

Maybe the ... could be a (let <for-bindings> <for-body-exprs>) so it would be more likely to be correct and not give errors of unknown symbols in the for body

👍 3
🙏 3
Vincent Cantin23:02:42

> … redefine the `for` macro in some way … That’s an excellent idea. I will try to redefine it as a fn in the env.

Vincent Cantin00:02:06

I guess it will have to be a macro because of the bindings.