Two related questions: (1) Do you agree that a lot of ex-Rubyists became clojurians? (2) If true, why do you think it happened?
https://de.surveymonkey.com/results/SM-CDBF7CYT7/ check Q3 looks like only 9% of clojure developers recognize ruby as primary
here you can get links to the results of other years https://clojure.org/news/2020/02/20/state-of-clojure-2020
That's only the recent questionnaire. You should probably look at the timeframe 2007-2012 to see if Clojure converted Rubyists to it.
Because after that time, it wasn't a sudden surprise that there was such an an alternative
The company that became Cognitect, Relevant, was a Ruby shop before Clojure came
fyi it was Relevance, not Relevant. there was definitely a surge at one point (around when Rich did the talk at RuPy)
generally people comfortable with dynamic typing but in need of better performance for server apps
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
sorry, Relevant was typo
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
Interestingly, I'm not a big fan of Ruby, but love Clojure.
You are not alone.
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.
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
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?
@matt.wistrand I wasn't using records much before and I still don't 🙂
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. ¯\(ツ)/¯
In my applications, I've not used Records yet, it's been maps all the way 🙂 (with a few vectors for good measure)
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.
I will not put words in @alexmiller'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.
Yup, Alex has said that if he were writing Clojure Applied today, he would use maps more and records less.
Thanks for the info!
This may be useful, it's a bit old, but I feel still quite useful:
I've rewritten clojure.spec from a protocol based impl to a map based impl because babashka couldn't handle protocols back then :)
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')
compare for equality or for ordering?
for equality... =
:)
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)
equality, thanks!
Clojure's = is a deep operation, checking all nested collection values
does it terminate early upon finding something that is not equal?
user=> (= '(0 1 2) (range))
false
that wouldn't have returned if it didn't exit early :D
:) I was gonna show
user=> (= [1 (reify Object (equals [_ _] (assert false)))] [2 3])
false
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
What’s the current ‘best way’ to import a local java jar into a CLJ project?
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)
I've used a maven store that works over s3, and "artifactory" (a saas artifact repository that works with maven) in the past
@jmckitrick If you're using the Clojure CLI / deps.edn
, local JARs are supported directly via :local/root
-- no need to install it.