Clojure for the Brave and True: Learn the Ultimate Language and Become a Better Programmer
B**R
A polished gem!
update: 2016-01-04: just finished chapter 6 "Organizing Your Project: A Librarian’s Tale". So far so good (fyi, I'm not working through this full time, so don't read too much into the tempo of my updates). Had some fiddle with the svg to get it to render on my ubuntu vm, but it got there. The most surprising thing was the use of -> and ->> (Thread First & Thread Last macros, respectively), which I had to do a little digging on to understand as I didn't see where it was covered in the text... I would have preferred to see the example code done "long-form way". But so far so good, I'm enjoying the read.Chapter 5 "Functional Programming" was both enjoyable and helpful, and the game example was pleasantly educational. I ended up manually keying large parts of the game function, just to get practice debugging and executing each bit and coding some unit tests to help me understand what it does. I also found the "assert" function on my own and coded up some tests in my clj file (not covered in the book, but figured I'd mention that here for anyone who is a fan of test driven development to consider): example...(defn row-num "Returns row number the position belongs to: row : positions 1 : 1 2 : 2 3 3 : 4 5 7" [pos] (inc (count (take-while #(> pos %) tri)))); tests... ; row# : positions...(assert (= 1 (row-num 1))) ; 1 : 1(assert (= 3 (row-num 5))) ; 2 : 2 3(assert (= 4 (row-num 10))) ; 3 : 4 5 6(assert (= 5 (row-num 15))) ; 4 : 7 8 9 10(assert (= 6 (row-num 16))) ; 5 : 11 12 13 14 15; tests on pos#'s 10, 15 & 16 ; 6 : 16 17 18 19 20 21; are intended to catch boundary conditions (spans rows 4, 5 & 6).(println "TESTS OK: row-num")I also ended up weaving "println"s and "let"s into the various functions to help me understand what they do. Makes the functions much more verbose, but helpful for my head to "see" what is going on in the inside.example:(defn connect "Form a mutual connection between two positions" [ board max-pos pos neighbor destination ] (do (if trace (println "\n---- connect: max-pos=" max-pos ", pos=" pos ", neighbor=" neighbor ", destination=" destination)) (if (<= destination max-pos) (let [ result (reduce (fn [new-board [p1 p2]] (do (if trace (do (println "reduce.new-board" new-board) (println "reduce.p1" p1) (println "reduce.p2" p2))) (assoc-in new-board [p1 :connections p2] neighbor))) board (do (if trace (do (println "reduce.new-board" new-board) (println "reduce.p1" p1) (println "reduce.p2" p2))) (assoc-in new-board [p1 :connections p2] neighbor))) board )] (if trace (println "\nresult=" result)) result) board)))( let [ c (connect {} 15 1 2 4)]; expected: {1 {:connections {4 2}}, 4 {:connections {1 2}}} (assert (= 2 (count c))) ; top level keys, 1 & 4. (assert (contains? c 1)) (assert (contains? (get c 1) :connections)) (assert (contains? (get (get c 1) :connections) 4)) (assert (= 2 (get (get (get c 1) :connections) 4))) (assert (contains? c 4)) (assert (contains? (get c 4) :connections)) (assert (contains? (get (get c 4) :connections) 1)) (assert (= 2 (get (get (get c 4) :connections) 1))) (println "TESTS OK: connects"))Chapters 4 "Core Functions in Depth" was interesting, I will be re-reading this again after the sequences and lazy evaluation has some time to sink in... this feels like it will be a big (albeit productive) change in my programmer's world-view. I especially enjoyed the smaller examples, they were thought provoking. For example: "If you want an exercise that will really blow your hair back, try implementing map using reduce, and then do the same for filter and some after you read about them later in this chapter."Chapter 3 "Do Things: A Clojure Crash Course" had a good temp; the 'hobbit violence' example actually helped me think through more traditional data structures and "clojure style".update: 2015-11-27: after driving emacs for a while, it reminds me of a much smarter notepad, while I miss the "surgical precision" that I can navigate with in vi, I can see making emacs my clojure ide.Love it! Life-long vi user here making the transition to emacs as part of the Clojure learning curve, and I found the online "Chapter 2 How to Use Emacs, an Excellent Clojure Editor". I bought the paperback version just now because Chapter 2 is simply That Awesome.Thank you, good sir, for making what looked like a steep learning curve seem very manageable.My favorite quote thus far:"Emacs was invented in, like, 1802 or something, so it uses terminology slightly different from what you’re used to. What you would normally refer to as a window, Emacs calls a frame..."I'm just not used to laughing that hard when reading technical books :-)Seriously, the author has put a LOT of energy and thought into how to boil down, package and guide the reader through a complex landscape and I'm impressed with how artfully they do it. I will update when I reach the end.
B**L
... for the Brave and True" is one of the best books, on any topic
"Clojure for the Brave and True" is one of the best books, on any topic, to come out in the last 350 years.This book is intended for folks who have already dabbled in Ruby or Javascript or something, and are ready for the next level, which is, of course, Clojure!It is punchy, relevant, well-written, and mercifully unbombastic. It is earthy, but it is lofty too. It is totally incomplete, thank goodness; you won't use it as a reference. But it should be good for "cracking the nut". The examples are brisk and plentiful, and except for the odd turn-of-a-page, they never exceed your field of vision (which is a great strength of Clojure).Some may think "for the brave and true" is just whimsy, but I believe the publisher's lawyers insisted on it. This book is not for dummies. Your curiosity, your high standards, and your impatience to start attacking real projects will be rewarded. The book frequently tosses out train-of-thought insights, invaluable clues to a "Clojure way" of making work easy.In the same vein as recommending chopsticks for Chinese food, the chapter about Emacs gets you into live REPL coding using traditional Lisp power tools for "structural editing" (time- and sanity-saving acrobatics with parentheses). But you can skip Emacs if you want; the rest of the book does not depend on it.The zany, off-hand tone sags toward the end, as though the author had had to be tranquilized before the book was finished and his step-mother took over. But this does not detract materially. She was almost as brave, and almost as true, just less flamboyant."Clojure for the Brave and True" gives you the lay of the land, with no claim of completeness. That is as it should be. It is strong on the principles, so you might continue learning in any way you want. A good next book would be Emerick, Carper & Grand's "Clojure Programming", which is even more meticulously principled, also very well written, and useful not only to finish coming up to speed but also as a reference work.
M**D
Clojure sucks
... but this is a really good book. It gets you through the languge introduction and gives good examples. The prose is good and the examples in the book have been proof read (a rare thing!) and work. I highly recommend reading this book, so you can make reasoned arguments about why having a REPL does not replace af debugger!
E**I
Fun and educational
First off- I would recommend skipping the emacs chapter.There are many options out there now, VS code with Calva being the most beginner friendly.This book is so much fun and it’s full of humor, memorable images, and wisdom.Daniel Higginbotham is an excellent teacher. Some of these topics are difficult to wrap your head around, but if you play with the code in the REPL and keep at it, things will start to click. I highly recommend this as a first resource for getting into Clojure - especially if you’re newer to programming in general.
V**H
Buen contenido, fácil de digerir
Para alguien que inicia con Clojure es una lectura que recomiendo por lo ameno con que aborda los temas.
F**X
amazing book
it s one of the best programming book I read.I learn quickly how to program Clojure program.It was a real pleasure to read it !
J**S
It’s very readable *and* informative. Two qualities not always found in the same book.
I’m only at chapter 3 - but love this book. Nice well thought out examples (including very importantly the diminutive/minimal use cases - that explain the essence of a particular function).All done with a great sense of humour- or possibly the author really does have some sort of issues with Hobbits-either way, works really well).
B**T
Not many good Clojure books. This is one of them. Buy it.
Humor helps to reduce the dryness of your standard programming book. Gets through the material in a delightful way. Recommend it highly.
K**P
Ein guter Einstieg in Clojure und Lisp - nichts für den Einstieg in die Programmierung!
Ich habe dieses Buch bereits angefangen online zu lesen und habe mich auf Grund der guten Qualität entschieden, dass Buch als Print zu beschaffen.Mir gefällt der Schreibstil und der Humor sehr gut.Clojure selbst ist schon ein schweres Thema. Mit der Lisp Syntax bzw. eben dem Fehlen einer Syntax muss man erst mal klarkommen. Meine ersten Lisp/Scheme Versuche tat ich mit Racket, daher ging.Dieses Buch beinhaltet auch eine kurze Einführung in Emacs. Ebenfalls mächtiges Thema. Bis jetzt springe ich immer zwischen Emacs und VS Code mit Calva hin und her.Der „Aha Moment“, den ich mit versprach, kam dann auch endlich, als man wirklich Macros definierte. Das Buch lässt sich wirklich gut am Stück schmökern und manchmal muss man eben erst die nächsten Kapitel lesen und wieder zurück blättern, bis das alles auf einmal Sinn ergibt. Daher werde ich dieses Buch sicherlich noch mindestens ein bis zwei Mal wälzen und mir die guten Beispiele noch mal im Detail angucken.Sehr empfehlenswert, wenn man in die Funktionale Programmierung einsteigen möchte, ohne gleich FP und ein umfangreiches Typsystem lernen zu müssen. Der Vorteil das Wissen dank des Java Ökosystems nicht nur akademisch verwenden zu können, belohnt den Weg auf jeden Fall.Aber es ist nichts für mal am Wochenende. Wer das akzeptiert wird sicherlich viel Spaß daran finden :)
Trustpilot
3 weeks ago
3 weeks ago