This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-28
Channels
- # adventofcode (2)
- # aleph (4)
- # announcements (3)
- # asami (13)
- # babashka (27)
- # beginners (74)
- # clj-kondo (18)
- # cljdoc (1)
- # cljs-dev (27)
- # cljsrn (5)
- # clojure (75)
- # clojure-australia (5)
- # clojure-europe (25)
- # clojure-uk (2)
- # conjure (1)
- # core-logic (1)
- # deps-new (1)
- # fulcro (13)
- # gratitude (8)
- # honeysql (1)
- # lsp (24)
- # missionary (45)
- # mount (2)
- # nextjournal (24)
- # off-topic (10)
- # pathom (5)
- # portal (3)
- # releases (1)
- # shadow-cljs (7)
- # specter (1)
- # tools-deps (1)
@quoll I don't know exactly what you're trying to do but confirming results via string conversion probably will be fraught
Actually… I am trying to do something unrelated. I’m trying to build a function compatible math
namespace for ClojureScript. I got caught out because I thought I was losing the sign from -0
, but on further investigation I learned that it just wasn't being printed at the repl and I was fine
After trying similar things on node and NOT losing the sign (according to the repl) it confused me for a long time, before using the ArrayBuffer trick to assert that the bit pattern was the same. (I already had a buffer for another purpose, so I went that way instead of thinking to ask Math.sign
). It was when I realized that it was just the printing at the cljs repl where the info was lost that I thought you'd want to know.
Math.sign()
is a thing in JS - perhaps that's a better for the assertion you want to make?
Not trying to do something. It was about identifying a difference in platforms. I know that it's not a goal to make them operate identically (which isn't possible) but given that node printed the difference at the prompt I thought it worth identifying
@danielcompton @borkdude I suppose Clojure encountered the same problem and relaxed the case for kwargs? we probably just need to call a non-checking constructor?
@dnolen the relaxation is just because of the new support in 1.11 for passing either trailing keywords or a trailing map
Clojure 1.10.1
user=> (defn f1 [a b & {:keys [c]}] [a b c])
#'user/f1
user=> (f1 1 2 [])
Execution error (IllegalArgumentException) at user/f1 (REPL:1).
No value supplied for key: []
interestingly @quoll the ability to roundtrip -0.0
is not even possible in JavaScript anyway
my theory is that the printing has always been wrong - and the it can only be corrected at the JS REPL
Yes, I was disappointed to see that conversion to a string lost the sign. I was left wondering what Node uses when it prints the number at the prompt
right I'm saying it's a magical thing most likely - i.e. nothing we can get at from the JS RT