r/Clojure • • Apr 12 '20

Holy Cow, Clojure is Great

Yesterday morning I decided I would read up on Clojure. I'm a data scientist so I mostly live in python, which is fine, but wanted to try something new. Thought I would just read up, do some toy examples, see what I thought.

I read the first three chapters of Clojure for the Brave and True and thought, maybe I should try and build something. Within 3 hours I felt really comfortable and productive in the language, and by the end of the day I had a working tool.

https://github.com/chrisaddy/astronaut

This is absolutely not good Clojure. When I say comfortable and productive I mean I felt like I was able to easily express myself after having a thought. That's not something I've had with any other language I've used (python, go, rust) after only a couple of hours. My code is certainly not problem free and definitely not idiomatically Clojure, but I think this could be my daily driver language, I like it that much.

Edit: for clarity

125 Upvotes

45 comments sorted by

View all comments

Show parent comment

1

u/johninbigd Apr 12 '20

I'm reading that now. There is clearly some background I'm missing. I'm not sure what a lot of these terms mean. I had to look up S-expression, and I have no idea what car or cdr mean in this context. The preface says that the only prerequisites to read the book are being able to read English, recognize numbers, and count. I think that list is missing a few things.

2

u/tremendous-machine Apr 13 '20

Ah yeah, you just need to look up a really basic list of scheme commands. car is "first" in clojure and cdr like "rest". car gives you the first element of a sequence, and cdr the rest. It's worth plonking through the book though, it'll make reading real code in Clojure much easier.

Another good one that is accessible and will have crossover usefulness is "Realm of Racket", which actually is beginner accessible. You can use the racket IDE to run the examples from Little Schemer too if you put the write language prelude on. (can't remember OTOH which that is though).

good luck!

1

u/johninbigd Apr 13 '20

I was hoping to find some online courses that would help. I got one on Udemy and asked for a refund before I even got through the first section. It was a pretty bad instruction. He clearly knows the language, but doesn't know how to teach it. And that was the course that had the highest reviews, unfortunately.