Live data from Hacker News

Clojure Distilled

yogthos.github.io

31–40 of 54 posts

Re: Clojure Distilled

#31
post #17

I 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.

Doesn'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.

Re: Clojure Distilled

#32
post #28

Earlier quoted context omitted.

I 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!

I also am a long time emacs user, but whenever a plugin freezes emacs I immediately stop using it. Is is cider now stable? I know nrepl.el would crash emacs frequently if you asked it to evaluate the wrong thing.

I'm not sure how long this feature has been around, but C-c C-b will abort any running evaluation(s)... I've used it more than once to save a non-responsive cider repl session.

Re: Clojure Distilled

#33
post #17

I 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.

I 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.

Yes, 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 with great success to get nicely formatted and colored Clojure errors and stack traces.

Re: Clojure Distilled

#34

I 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 is…

> even if you are mere a brainwashed Java dev

I see where you're coming from, SLW.

Re: Clojure Distilled

#35
Extracting 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))

Re: Clojure Distilled

#36
post #9

I'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.

My personal favorite editor is IntelliJ IDEA Community Edition + cursiveclojure.com plugin (not affiliated with the cursiveclojure.com people but highly recommend it). I don't come from an Emacs background but from what I've seen and heard from Emacs people is that it combines all the best parts of Emacs when it comes to Lisp code manipulation.

I'm the developer of Cursive - thanks to you and others in this thread, I'm really glad you're all liking it!

Re: Clojure Distilled

#37

  Higher 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.

Re: Clojure Distilled

#38
post #19

I'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.

Seconded. 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.

Re: Clojure Distilled

#39
post #28

Earlier quoted context omitted.

I also am a long time emacs user, but whenever a plugin freezes emacs I immediately stop using it. Is is cider now stable? I know nrepl.el would crash emacs frequently if you asked it to evaluate the wrong thing.

I'm not sure how long this feature has been around, but C-c C-b will abort any running evaluation(s)... I've used it more than once to save a non-responsive cider repl session.

Well I've been using cider / nrepl.el for a long time and never knew this. Don't know how I missed it.

Thank you.

Re: Clojure Distilled

#40

Higher 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.

Only if it enhances the poetic value.
Post reply on HN