Fork me on GitHub
#clojure
<
2020-11-24
>
stathissideris10:11:14

Two related questions: (1) Do you agree that a lot of ex-Rubyists became clojurians? (2) If true, why do you think it happened?

delaguardo11:11:14

https://de.surveymonkey.com/results/SM-CDBF7CYT7/ check Q3 looks like only 9% of clojure developers recognize ruby as primary

delaguardo11:11:07

here you can get links to the results of other years https://clojure.org/news/2020/02/20/state-of-clojure-2020

borkdude11:11:36

That's only the recent questionnaire. You should probably look at the timeframe 2007-2012 to see if Clojure converted Rubyists to it.

borkdude11:11:57

Because after that time, it wasn't a sudden surprise that there was such an an alternative

borkdude11:11:20

The company that became Cognitect, Relevant, was a Ruby shop before Clojure came

Alex Miller (Clojure team)14:11:17

fyi it was Relevance, not Relevant. there was definitely a surge at one point (around when Rich did the talk at RuPy)

Alex Miller (Clojure team)14:11:53

generally people comfortable with dynamic typing but in need of better performance for server apps

lukasz14:11:43

It definitely was a trend 7-5 years ago (my team moved from Ruby to Clojure around that time) and I remember "Clojure vs Ruby" type talks happening at various meetups and what not. Puppet for example wrote Puppet server in Clojure around that time (IIRC) while puppet core is still a DSL written in Ruby etc etc

borkdude14:11:07

sorry, Relevant was typo

noisesmith16:11:46

I've definitely worked full time for multiple companies that did their first draft in ruby but switched to clojure for performance / server resource reasons

didibus18:11:41

Interestingly, I'm not a big fan of Ruby, but love Clojure.

borkdude18:11:08

You are not alone.

didibus18:11:00

I think that could indicate that Clojure is just all around better than Ruby, and since Ruby has no killer ecosystem like Python, it make sense that Clojure would attract Rubyist. You get access to a larger eco-system (jvm/js), better safety (immutable/functional), better performance (multi-threaded/JIT), better interactivity (REPL), and I'm skipping on the details.

didibus18:11:58

I think if Clojure had have a RAILS competitor, there'd be even more of an exodus. Now I think, since Elixir has created a RAILS competitor (Pheonix), I think Rubyist are now moving to Elixir over Clojure

dgb2320:11:49

This discussion strikes me as interesting. I never considered Clojure because of runtime performance. My projects are typical custom web based software/tools/sites. The reason I initially got into learning it and now using it for real is that I got increasingly frustrated by other languages. The paradigms, the boilerplate, the weird workarounds… Then I remembered Scheme and Racket and looked for something that is like those but with a stronger focus on production.

mjw19:11:53

For those of you who use spec, how has adopting spec affected your usage of records? Do you find yourselves now preferring maps over records, or has your use of records continued unchanged?

seancorfield20:11:17

@matt.wistrand I wasn't using records much before and I still don't 🙂

👍 3
mjw20:11:39

I haven’t used records much either apart from components (and it looks like that’s not necessary anymore), but I recently picked up Clojure Applied and noticed that records are used for data modeling there. ¯\(ツ)

dharrigan20:11:30

In my applications, I've not used Records yet, it's been maps all the way 🙂 (with a few vectors for good measure)

andy.fingerhut20:11:14

I will not put words in @U064X3EF3's mouth, but I have a dim recollection of him commenting on whether he would emphasize them as much if he wrote the book today.

seancorfield20:11:31

Yup, Alex has said that if he were writing Clojure Applied today, he would use maps more and records less.

👍 3
mjw20:11:01

Thanks for the info!

dharrigan20:11:52

This may be useful, it's a bit old, but I feel still quite useful:

borkdude21:11:17

I've rewritten clojure.spec from a protocol based impl to a map based impl because babashka couldn't handle protocols back then :)

denik21:11:43

What’s the fastest way to logically compare two data-structures containing values of different types?

(compare [:a "a"]
         [:a 1])
Execution error (ClassCastException) at java.lang.String/compareTo (String.java:134).
class java.lang.Long cannot be cast to class java.lang.String (java.lang.Long and java.lang.String are in module java.base of loader 'bootstrap')

Alex Miller (Clojure team)21:11:22

compare for equality or for ordering?

Alex Miller (Clojure team)21:11:59

for ordering, you'll need to make a custom comparator that can handle whatever types you want to handle (lots of choices to make there)

denik21:11:14

equality, thanks!

Alex Miller (Clojure team)21:11:50

Clojure's = is a deep operation, checking all nested collection values

denik22:11:39

does it terminate early upon finding something that is not equal?

noisesmith22:11:04

user=> (= '(0 1 2) (range))
false

noisesmith22:11:14

that wouldn't have returned if it didn't exit early :D

😁 3
bronsa22:11:35

:) I was gonna show

user=> (= [1 (reify Object (equals [_ _] (assert false)))] [2 3])
false

noisesmith22:11:35

but as @bronsa shows, it's up to each object to define how it implements an equality check - most collections short circuit before checking the full input

🙏 3
jmckitrick22:11:50

What’s the current ‘best way’ to import a local java jar into a CLJ project?

noisesmith22:11:19

you can use eg. lein or mvn to install it to the local cache, but usually you'd want to also have that jar propagate to a maven repository somewhere (so other devs, or ci, can use the same artifacts)

noisesmith22:11:38

I've used a maven store that works over s3, and "artifactory" (a saas artifact repository that works with maven) in the past

seancorfield23:11:32

@jmckitrick If you're using the Clojure CLI / deps.edn, local JARs are supported directly via :local/root -- no need to install it.