7 ms·
Clojure Distilled
- daveloyall 12y agoThat link is down for me, but I think this is the same content? http://yogthos.github.io/ClojureDistilled.html http://yogthos.github.io/ClojureDistilled.html
- sternenseemann 12y agoalso this works via rawgit: https://cdn.rawgit.com/yogthos/yogthos.github.com/master/ClojureDistilled.html https://cdn.rawgit.com/yogthos/yogthos.github.com/master/Clo...
- daveloyall 12y agoNoted, thanks!
- jkrems 12y agoBut the "real" URL also would have proper CSS etc. and looks slightly less broken.
- dang 12y agoThanks! We changed to that from https://rawgit.com/yogthos/yogthos.github.com/master/ClojureDistilled.html https://rawgit.com/yogthos/yogthos.github.com/master/Clojure....
- profil 12y agoWhen using rawgit, please follow the owners request about using cdn.rawgit.com for anything that might result in heavy traffic. I guess links submitted to HN often results in heavy traffic. https://rawgit.com/faq#diff-between-rawgit-and-cdn https://rawgit.com/faq#diff-between-rawgit-and-cdn
- infogulch 12y agoSo the url should be changed to this (which loads for me): https://cdn.rawgit.com/yogthos/yogthos.github.com/master/ClojureDistilled.html https://cdn.rawgit.com/yogthos/yogthos.github.com/master/Clo...
- serve_yay 12y agoWould it really be so difficult to redirect my request...
- deleted 12y ago[deleted]
- jdeisenberg 12y agoIt's a very good summary.
- nelsonenzo 12y agocorrect link here https://cdn.rawgit.com/yogthos/yogthos.github.com/master/ClojureDistilled.html https://cdn.rawgit.com/yogthos/yogthos.github.com/master/Clo...
- arms 12y agoI'm currently learning Clojure. For all the "aha!" moments, there are plenty of "WTFs?", too. Not that it's a fault of the language, it's just that it requires a different way of looking at things. I've only skimmed this article, but look forward to reading it in depth later. Thanks! I'd be interested if anyone has some similar pieces to share.
- verisimilidude 12y agoMost of my Clojure WTFs were not related to the language itself, but rather the tooling. This was years ago, but everyone used to say, "Before diving into Clojure, you should really learn emacs and all these other things first." I'm glad I ignored them and sputtered along in a text editor while learning the basics of the language, because I would've otherwise burnt out. With apps like Light Table now available, maybe beginners have an easier ramp these days.
- arms 12y agoGood to know! I started with emacs, but decided to use Light Table for now. Nothing against emacs, but I don't want to make things harder by learning a new language and a new editor at the same time. Aside from Light Table (and presumably Leiningen) do you have any other tooling recommendations?
- elwell 12y agoI chose to learn both at the same time, and would recommend it if you're willing to buckle down for a month or two of frustration. I really feel like I further developed my ability to go head first into learning in a way I had in the past. Still learning a lot though about both. I should mention that I'm a freelancer; if I was an employee it might be hard to get a way with spending so much time learning rather than producing in the short-term.
- craigching 12y agoI will say that cider has done a very nice job of getting interactive development using Emacs to work well. I am a 20+ year Emacs user and love working with Clojure via cider. I will say that I think getting started with Light Table is a great way to start, but don't leave Emacs too far behind! Good luck go you!
- deleted 12y ago[deleted]
- killercup 12y agoI'm not done reading but it seems like a very nice introduction to people not familiar with the function style of programming. This is also one of the few document that can be converted from html to epub without much pain. It looks quite good with pandoc ClojureDistilled.html -o ClojureDistilled.epub --indented-code-classes=clojure
- fdsary 12y agoI love clojure, and dream of the day I can work with it. But do you know why more people get into ruby or js? It's community is beginner friendly. Most texts on the subject of lisps feel like wannabe dissertations, preferably with the Computer Modern font and 5 pages long.
- erichmond 12y agoThese links seem pretty beginner friendly to me. http://tryclj.com/ http://tryclj.com/ http://www.braveclojure.com/ http://www.braveclojure.com/ http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome http://aphyr.com/posts/301-clojure-from-the-ground-up-welcom... http://clojurekoans.com/ http://clojurekoans.com/ http://www.4clojure.com/ http://www.4clojure.com/
- oinksoft 12y agoI would never suggest a programmer learn Clojure as their first language, because of the enormous Java stacktraces. Then there's the setup involved (Java, usually Leiningen) to get to "Hello, World" compared to Python or Ruby. Just too many places where the student can get seriously stuck. Clojure's strengths (immutable structures, expression freedom, macros, Java interop, JVM) are not relevant to the new programmer.
- raspasov 12y agoYes, the Java stack traces are probably the worst "ugly" thing in Clojure but from my experience the simplicity of syntax (not to be confused with familiarity, familiar != simple) makes it much easier for someone who's never programmed before to start writing Clojure code vs many other languages where there's a lot of syntax to that you simply need to "know" to get going. Also, on a more advanced note, I've used https://github.com/ptaoussanis/timbre https://github.com/ptaoussanis/timbre with great success to get nicely formatted and colored Clojure errors and stack traces.
- akurilin 12y agoDoesn't have to be just a dream, check out HN's Who's Hiring for September, plenty of opportunities to have your everyday work be in Clojure out there, including our company.
- d_t_w 12y agoI've been working with Clojure for 18 months now, after a bit more than 10 years of Java. I'm having so much fun I don't think I could ever go back. Also, this is an excellent summary / introduction to key clojure concepts, well done to the author.
- kjjw 12y agoSeconded. I was working with a mix of Java and Ruby for roughly a decade. I've been working full time with Clojure for about two years now, and on and off for a couple of years before that. Fantastic introductory guide. Clojure really needs something like this. There are some good books on Clojure but I find they are aimed at either the determined beginner or the experienced (or both.) This though I feel I could pass around to anyone that wants to get an idea of what Clojure is about.
- tim333 12y agoThe main link's stopped working with a message to use the cdn version instead: https://cdn.rawgit.com/yogthos/yogthos.github.com/master/ClojureDistilled.html https://cdn.rawgit.com/yogthos/yogthos.github.com/master/Clo...
- sailfast 12y agoI'm really enjoying reading this - thanks! For those that don't want to tax the owner of rawgit - try github pages - it's just HTML, right? http://yogthos.github.io/ClojureDistilled.html http://yogthos.github.io/ClojureDistilled.html
- dschiptsov 12y agoI am really suggesting to try some classic Scheme course first, like my favorite CS61A by Brian Harvey, or that wonderful Racket-based course (what's the difference?) on Coursera by Gregor Kiczales (which is worth watching even if you are mere a brainwashed Java dev). Another way is through pg's books, especially, of course, "On Lisp" and Arc tutorial and then arc.arc (original version from the 2009 arc3.tar which isn't cluttered with silly docstrings and other nonsense). There is also the way of CL. For that there is pg's ANSI CL, but before that a much better "CL Language Concepts" from Symbolics (pdfs are available from bitsavers). Then, perhaps, one will have slightly different view of what Clojure is really. Yes, it is a real marvel of software craftsmanship, especially that it was originally a solo effort, but no, there is no miracles in it.)
- ExpiredLink 12y ago> even if you are mere a brainwashed Java dev I see where you're coming from, SLW.
- zak_mc_kracken 12y ago> which is worth watching even if you are mere a brainwashed Java dev And people wonder why Lisp advocates have such a bad reputation.
- AlexeyBrin 12y agowhich is worth watching even if you are mere a brainwashed Java dev and this is why so many people are repelled by the Lisp (or Scheme) evangelism. I don't particularly like Java, but I use it for Android development. Calling people brainwashed because they are using Java is simply rude.
- dschiptsov 12y agoIn my opinion Java is the biggest fraud and waste in the history of IT (next comes SAP) - nothing but hype, ignorant parroting of silly memes by "managers" (so-called bandwagon and peer effects) lies, and taking advantage of ignorant. People who "know no better" (cannot even visit the rosettacode.org, dismissed plain old C - these evil pointers!, Erlang - functional programming is for academy, or CL - not an enterprise level, etc, etc) are, well, brainwashed. I am not blaming the people, I am just describing reality as I see it, and my view is by no means new or even "original". Java was just a way to make money (in 2000s) like "derivatives traders" in the last 10 years. Same manipulations, same techniques. For example, almost all of the very few popular apps I have installed on my Nexus4 are NDK apps - FB, Viber, Skype - you name it.
- zeroyzeroa 12y agoExtracting keys from maps into a definition, with common-lisp (using my macro defk) (defk login (user pass) (and (string= user "Bob") (string= pass "secret"))) (login (list-to-hash '(user "Bob" pass "secret")) (list-to-hash '(user "Bob" pass "secret")) Given the following definitions: (defmacro defk(name h-list &rest body) `(defun ,name (h) (let ,h-list ,@(loop for k in h-list collect `(setq ,k (gethash (quote ,k) h))) ,@body))) (defun list-to-hash(list) (let ((h (make-hash-table))) (loop for (k v) on list by #'cddr do (setf (gethash k h) v)) h))
- malisper 12y agoIt's probably more idiomatic to implement something similar to the with-slots macro by using symbol-macrolet: (defmacro with-keys (keys table &body body) (let ((gtable (gensym))) `(let ((,gtable ,table)) (symbol-macrolet ,(loop for k in keys collect `(,k (gethash ',k ,gtable))) ,@body)))) This way you can both access and set the keys: CL-USER> (defparameter *table* (make-hash-table)) *TABLE* CL-USER> (setf (gethash 'a *table*) 10 (gethash 'b *table*) 20) 20 CL-USER> (with-keys (a b) *table* (list a b)) (10 20) CL-USER> (with-keys (a b) *table* (setf a 100 b 200)) 200 CL-USER> (list (gethash 'a *table*) (gethash 'b *table*)) (100 200) If you really want to destructure a hash-table when its an argument, it is not much harder to write a new version of defun on top of with-keys or zeroyzeroa's solution (his/hers only takes a single argument).
- fnordsensei 12y agoHigher order functions can be easily chained together to create complex transformations: (filter even? (map #(* 3 %) [1 2 3 4 5])) =>(6 12) This will need to be updated to make use of transducers, I guess.
- rbanffy 12y agoOnly if it enhances the poetic value.