This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-14
Channels
- # announcements (13)
- # aws (2)
- # babashka (17)
- # beginners (80)
- # biff (10)
- # cljs-dev (51)
- # cljsrn (6)
- # clojure (42)
- # clojure-australia (9)
- # clojure-boston (2)
- # clojure-europe (17)
- # clojure-sweden (3)
- # clojure-uk (53)
- # clojurescript (44)
- # code-reviews (2)
- # core-async (5)
- # cryogen (3)
- # cursive (32)
- # datahike (1)
- # datomic (11)
- # events (1)
- # fulcro (22)
- # helix (3)
- # honeysql (3)
- # leiningen (4)
- # lsp (30)
- # luminus (13)
- # malli (5)
- # off-topic (115)
- # other-languages (5)
- # pathom (10)
- # polylith (23)
- # re-frame (24)
- # reagent (10)
- # releases (2)
- # shadow-cljs (124)
why does this not work?
(#(+ %&) 1 2 3)
Execution error (ClassCastException) at java.lang.Class/cast (Class.java:3068).
Cannot cast class clojure.lang.ArraySeq to class java.lang.Number
(apply + [1 2 3])
6
(+ [1 2 3])
Execution error (ClassCastException) at java.lang.Class/cast (Class.java:3816).
Cannot cast clojure.lang.PersistentVector to java.lang.Number
yea, %& is a seq:
> (#(prn %&) 1 2 3)
(1 2 3)
(+ 1 2 3)
calls + with three arguments. (+ [1 2 3])
calls + with only argument (of the wrong type, so it gives an error).
Hence you need apply
- you can see some examples here https://clojuredocs.org/clojure.core/apply
I understand now, thank you @U015KH5ENEM
where did the clojure logo come from? I get the lambda in the middle, but why on top of a green-blue yin-yang?
Might also be a reference to eval / apply. http://www.sicp-book.com/book-Z-H-26.html#%_sec_4.1.1
And lets not forget the clear reference to the international peace symbol ☮️. A truly genius logo!
Did someone already tried to, when execute a lein test
or lein midje
. It also executes a docker-compose up
for integration testing?
How do EDN and JSON compare to each other? Thoughts and resources?
I wrote this comparison of edn, transit, and fressian long ago, but I think it's still a good overview https://groups.google.com/g/clojure/c/9ESqyT6G5nU/m/2Ne9X6JBUh8J
for edn vs JSON, edn has a richer base set of data types and importantly is extensible so you can define your "date" or anything else (via tagged literals). it also tends to be more concise (mostly due to the absence of : and , in maps/arrays)
edn is imo strictly better than JSON, yaml, or whatever as a human-centered data format for configuration etc
Can you elaborate on the human-centered data format point?
a format you expect people to read/write/edit in a file
but, you're going to find much higher performance parsers for json than for edn (particularly in the browser) so then I'd consider transit (or fressian)
Can you elaborate on the human-centered data format point?
Do other programming languages have good ways to interpret and use EDN?
Lots of them do. I have personally used EDN libraries in C++, Haskell, Ruby, and Python. I have seen more out there that I have not used.
hey all, qq on sorted maps… is it expected that this should throw?
((sorted-map 0 2) :face)
class java.lang.Long cannot be cast to class clojure.lang.Keyword (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.Keyword is in unnamed module of loader 'app')
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentTreeMap.java#L313-L326
ah, it’s happening here. it’s because the sorted map keeps an internal comparator, so (compare 0 :face)
fails for the same reason
sorted maps/sets should have a comparator that handles whatever you put in it (or you should not put that stuff in it)
👍 thank you!
I have this problem, that our WebSocket messages over 64 kB in size break the connection. The message seems to go to the server, where Sente + Aleph somehow drop the ball: https://github.com/ptaoussanis/sente/issues/389 @ptaoussanis Is there some hard limit somewhere that could be tweaked or worked around?
This seems to happen both when using EDN and/or Transit as well