Live data from Hacker News

Clojure Distilled

yogthos.github.io

41–50 of 54 posts

Re: Clojure Distilled

#41
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've never had cider or the old nrepl.el crash or freeze on me, they've always worked fine. I develop on Mac OSX and Linux, what platform are you on? And what Emacs version? I tend to be on the latest GNU releases. Are you using a GNU Emacs or something else? If you're on Mac, I highly recommend this distribution [1]

[1] -- http://emacsformacosx.com

Re: Clojure Distilled

#42
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've never had cider or the old nrepl.el crash or freeze on me, they've always worked fine. I develop on Mac OSX and Linux, what platform are you on? And what Emacs version? I tend to be on the latest GNU releases. Are you using a GNU Emacs or something else? If you're on Mac, I highly recommend this distribution [1] [1] -- http://emacsformacosx.com

I'm on the latest release of GNU emacs. I'm mostly on Windows, which could be the issue.

Re: Clojure Distilled

#43
post #42

Earlier quoted context omitted.

I've never had cider or the old nrepl.el crash or freeze on me, they've always worked fine. I develop on Mac OSX and Linux, what platform are you on? And what Emacs version? I tend to be on the latest GNU releases. Are you using a GNU Emacs or something else? If you're on Mac, I highly recommend this distribution [1] [1] -- http://emacsformacosx.com

I'm on the latest release of GNU emacs. I'm mostly on Windows, which could be the issue.

I use Emacs on Windows too, but I don't develop there, it's mostly a glorified notepad for initial analysis of log files, so I can't really help there. I would recommend getting melpa setup on your emacs and keep cider as up-to-date as possible to see if that helps, assuming you're not doing that already either via melpa or directly from source.

Good luck to you!

Re: Clojure Distilled

#44

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)…

It'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).

Re: Clojure Distilled

#45

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…

> which is worth watching even if you are mere a brainwashed Java dev

And people wonder why Lisp advocates have such a bad reputation.

Re: Clojure Distilled

#46

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…

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

Re: Clojure Distilled

#47
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.

Most 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…

I never got into Emacs myself, I started with Eclipse and then moved to Cursive (https://cursiveclojure.com/) which I simply can't recommend enough, I also use Light Table for some of my smaller projects.

The fact that you don't have to use Emacs to work with Clojure is a huge benefit in my opinion. Emacs takes a lot of investment to learn and use effectively, and not everybody has the time, nor the inclination to do that.

Re: Clojure Distilled

#48
post #14
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.

So I'm about half way through it now. I'm really impressed with how much information it's conveying in a succinct form. I'm going through Clojure for the Brave and True, and think this supplements it nicely. There are a few typos, but the most glaring one was the incomplete python code underneath the "Code Structure" heading: l = [1, 2, 3, 4, 5] for i in l i = i*i for i in l if (i mod 2 == 0) print l I assume the aut…

thanks, I just fixed that, I'm not a python guy as you can tell :)

Re: Clojure Distilled

#49
post #3

When 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

[deleted]

Re: Clojure Distilled

#50
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.

For emacs/clojure users I highly recommend Sam Aaron's Emacs Live. It is an "opinionated" emacs setup and while some of the opinions might not be to your liking, it is really easy to set up and get going with clojure using it.
Post reply on HN