This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-06
Channels
- # adventofcode (106)
- # aleph (1)
- # announcements (1)
- # asami (14)
- # babashka (120)
- # beginners (54)
- # calva (106)
- # chlorine-clover (33)
- # clj-kondo (5)
- # cljdoc (3)
- # cljs-dev (3)
- # clojure (92)
- # clojure-android (1)
- # clojure-australia (2)
- # clojure-europe (24)
- # clojure-italy (3)
- # clojure-nl (5)
- # clojure-uk (16)
- # clojuredesign-podcast (1)
- # clojurescript (29)
- # code-reviews (58)
- # conjure (16)
- # core-logic (4)
- # cursive (9)
- # datalevin (2)
- # graphql (20)
- # gratitude (7)
- # jackdaw (11)
- # java (9)
- # jobs (2)
- # lsp (23)
- # minecraft (1)
- # missionary (28)
- # off-topic (5)
- # polylith (5)
- # react (1)
- # reagent (12)
- # releases (1)
- # remote-jobs (4)
- # reveal (7)
- # shadow-cljs (8)
- # slack-help (1)
- # tools-deps (11)
- # vim (6)
Hey. What's a good library with ClojureScript for handling requests; GET, POST, PUT, etc..
also venerable - https://github.com/funcool/httpurr which has node.js support, haven't found many libs that do
I’m getting a warning when compiling the following code:
cljs.core/-, all arguments must be numbers, got [#{js/clj-nil clj-nil} #{js/clj-nil clj-nil}] instead
(- (ocall scale :invert translate-delta) (ocall scale :invert 0))
^---
I expected that I could fix it like this:
(- ^js/number (ocall scale :invert translate-delta) ^js/number (ocall scale :invert 0))
But that gives me exactly the same warning. What am I missing?Are you sure that these calls are returning numbers (ocall scale :invert translate-delta) (ocall scale :invert 0)
based on warning it seems like they're returning nil instead.
I don't believe this is based on runtime values. This is the cljs compiler thinking these functions return nil (and maybe they do but this is metadata and tags based)
They definitely return numbers. The code works perfectly. But I'd like to be warning clean if possible?
(The functions, BTW, are from Vega).
If I evaluate (type {})
I see cljs.core/PersistentArrayMap
. Is there some way to get that symbol from a value? (str (type {}))
returns the function’s toString from what I can tell, there is no meta
, and (.-name (type {}))
returns an empty string. Other things I can do?
If it interests anybody, I got a CLJS pREPL working inside JVM unit tests so you can eval CLJS expressions while testing from the JVM. This is useful for the cljs-math lib to compare Node.js results to the JVM results. https://github.com/quoll/cljs-math/blob/baf0a46781ca4cd5d0b0d85977141de58a9bf4f8/test/cljs/math/test_prepl.clj#L33-L46
you don't need sockets really. can just setup streams directly and skip all the network stuff
I basically copied something from the babashka tests which also has a prepl and reused that
@dpsutton this is with 1.10.893.
to diagnose, if you replace the call sites with (or (ocall scale ...) 0)
does the warning go away?
Yes, that does make it go away.
Then i think it is a bug in the type inference going on. You can use this or
hack, or I think there’s a way to turn off particular warnings. You could also create an issue on http://ask.clojure.org, ideally with a minimum reproduction. Simple deps.edn, with that single dep, or ideally just copy the functionality that recreates the issue, and keep removing extraneous bits until a simple reproduction exists
Cool. Will do 👍 Thanks!