Fork me on GitHub

why does this not work?

(#(+ %&) 1 2 3)
Execution error (ClassCastException) at java.lang.Class/cast (
Cannot cast class clojure.lang.ArraySeq to class java.lang.Number


(#(apply + %&) 1 2 3)


(apply + [1 2 3])
(+ [1 2 3])
Execution error (ClassCastException) at java.lang.Class/cast (
Cannot cast clojure.lang.PersistentVector to java.lang.Number


yea, %& is a seq:

> (#(prn %&) 1 2 3)
(1 2 3)


how is (+ 1 2 3) different?


thank you for the replies


(+ 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

👀 3

I understand now, thank you @U015KH5ENEM


You're welcome

Juλian (he/him)08:05:18

where did the clojure logo come from? I get the lambda in the middle, but why on top of a green-blue yin-yang?

Ivan Koz17:05:47

^ yep, reference to an iconic book, look at the crystal ball in the mage's hand


And lets not forget the clear reference to the international peace symbol ☮️. A truly genius logo!

Ramon Rios16:05:35

Did someone already tried to, when execute a lein test or lein midje . It also executes a docker-compose up for integration testing?

Rob Haisfield17:05:33

How do EDN and JSON compare to each other? Thoughts and resources?

Alex Miller (Clojure team)17:05:21

I wrote this comparison of edn, transit, and fressian long ago, but I think it's still a good overview

👍 9
Alex Miller (Clojure team)17:05:34

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)

Alex Miller (Clojure team)17:05:49

edn is imo strictly better than JSON, yaml, or whatever as a human-centered data format for configuration etc

☝️ 30
Rob Haisfield18:05:13

Can you elaborate on the human-centered data format point?

Alex Miller (Clojure team)19:05:35

a format you expect people to read/write/edit in a file

Alex Miller (Clojure team)17:05:36

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)


What does the last c in .cljc stand for? "Common"?


Thanks. :thumbsup::skin-tone-2:


or "c"onditional?

Rob Haisfield18:05:47

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.

Sam Ritchie19:05:11

hey all, qq on sorted maps… is it expected that this should throw?

Sam Ritchie19:05:13

((sorted-map 0 2) :face)

Sam Ritchie19:05:20

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')

Sam Ritchie19:05:22

ah, it’s happening here. it’s because the sorted map keeps an internal comparator, so (compare 0 :face) fails for the same reason

Alex Miller (Clojure team)19:05:38

sorted maps/sets should have a comparator that handles whatever you put in it (or you should not put that stuff in it)

Sam Ritchie19:05:07

👍 thank you!

Adam Kalisz21:05:44

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: @ptaoussanis Is there some hard limit somewhere that could be tweaked or worked around?

Adam Kalisz21:05:49

This seems to happen both when using EDN and/or Transit as well