clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
lilactown 2021-05-14T04:37:20.354900Z

no, like monthly downloads or something

seancorfield 2021-05-14T04:41:02.355100Z

They're a bit meaningless, because you don't really "download" Clojure, you depend on it and it's up to individual Maven-like installations whether they need to download it or not.

seancorfield 2021-05-14T04:41:50.355300Z

If your local repo has a copy, you don't need to download it. If you're starting fresh every time, you'll download it every time.

flowthing 2021-05-14T04:50:31.355500Z

Probably even less meaningful than Maven stats, but I've seen this link around multiple times when the topic of Clojure has come up in another forum (http://lobste.rs, HN, company chat, etc.): https://trends.google.com/trends/explore?date=all&q=%2Fm%2F03yb8hb

flowthing 2021-05-14T04:53:45.355800Z

Apart from that, there's this regarding Maven download stats (from a year ago): https://pay.reddit.com/r/Clojure/comments/eakyfu/is_clojure_on_the_decline/favzns1/

oboff 2021-05-14T05:15:32.356900Z

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

djm 2021-05-14T05:19:46.357300Z

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

djm 2021-05-14T05:20:06.357500Z

(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

phronmophobic 2021-05-14T05:20:37.357700Z

yea, %& is a seq:

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

oboff 2021-05-14T05:21:44.357900Z

how is (+ 1 2 3) different?

oboff 2021-05-14T05:21:53.358100Z

thank you for the replies

djm 2021-05-14T05:25:50.358300Z

(+ 1 2 3) calls + with three arguments. (+ [1 2 3]) calls + with only argument (of the wrong type, so it gives an error).

➕ 1
djm 2021-05-14T05:26:32.358600Z

Hence you need apply - you can see some examples here https://clojuredocs.org/clojure.core/apply

👀 1
oboff 2021-05-14T05:30:03.359Z

I understand now, thank you @djm_uk

djm 2021-05-14T05:30:23.359200Z

You're welcome

Juλian (he/him) 2021-05-14T08:23:18.360200Z

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

2021-05-25T08:13:49.374700Z

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

oboff 2021-05-14T09:08:55.360300Z

https://qr.ae/pGv2cd

Juλian (he/him) 2021-05-14T09:23:44.360600Z

thanks!

👍 1
Ramon Rios 2021-05-14T16:32:35.362800Z

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

zane 2021-05-14T16:53:47.362900Z

Might also be a reference to eval / apply. http://www.sicp-book.com/book-Z-H-26.html#%_sec_4.1.1

Ivan Koz 2021-05-14T17:01:47.363100Z

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

2021-05-14T17:15:33.364200Z

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

alexmiller 2021-05-14T17:23:21.364700Z

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

👍 3
alexmiller 2021-05-14T17:25:34.366400Z

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)

alexmiller 2021-05-14T17:26:49.367800Z

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

☝️ 10
alexmiller 2021-05-14T17:27:36.368600Z

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)

flowthing 2021-05-14T18:39:45.369700Z

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

borkdude 2021-05-14T18:44:16.370Z

or "c"onditional?

1
2021-05-14T18:49:47.371600Z

Do other programming languages have good ways to interpret and use EDN?

simongray 2021-05-16T08:35:58.398100Z

https://github.com/cognitect/transit-format#implementations

👍 1
blak3mill3r 2021-05-24T04:55:44.299400Z

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 Ritchie 2021-05-14T19:05:11.372100Z

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

Sam Ritchie 2021-05-14T19:05:13.372500Z

((sorted-map 0 2) :face)

Sam Ritchie 2021-05-14T19:05:20.372800Z

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 Ritchie 2021-05-14T19:08:22.373500Z

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

alexmiller 2021-05-14T19:19:27.373700Z

common

alexmiller 2021-05-14T19:19:43.374Z

yes

alexmiller 2021-05-14T19:20:38.374500Z

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

alexmiller 2021-05-14T19:21:35.374600Z

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

Sam Ritchie 2021-05-14T19:53:07.374900Z

👍 thank you!

flowthing 2021-05-14T19:55:52.375Z

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

Adam Kalisz 2021-05-14T21:52:44.377600Z

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?

Adam Kalisz 2021-05-14T21:53:49.378200Z

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