Live data from Hacker News

Introduction to Clojure

cio.com.au

1–10 of 23 posts

Re: Introduction to Clojure

#5
Don't arrange your closing parens the way the author of this article has unless you want to look like a clueless noob.

Edit: There are other style problems with this article. Worst is probably this one:

  Bad: (map (fn [x] (fibonacci x)) [1 2 3 5 6 7 8 9 10])
  Good: (map fibonacci (range 1 11))

Re: Introduction to Clojure

#6
post #5

Don't arrange your closing parens the way the author of this article has unless you want to look like a clueless noob. Edit: There are other style problems with this article. Worst is probably this one: Bad: (map (fn [x] (fibonacci x)) [1 2 3 5 6 7 8 9 10]) Good: (map fibonacci (range 1 11))

Interesting, since it is actually in some ways easier to see which closing paren goes with which opening one.

My 'C' parser keeps telling me 'wrong bracket' though :)

Re: Introduction to Clojure

#7
post #6
post #5

Don't arrange your closing parens the way the author of this article has unless you want to look like a clueless noob. Edit: There are other style problems with this article. Worst is probably this one: Bad: (map (fn [x] (fibonacci x)) [1 2 3 5 6 7 8 9 10]) Good: (map fibonacci (range 1 11))

Interesting, since it is actually in some ways easier to see which closing paren goes with which opening one. My 'C' parser keeps telling me 'wrong bracket' though :)

Yes, which is why it is a newbie signal. A Lisp programmer with more than about three weeks of experience doesn't look at parentheses or try to match them up with each other. You know the function has ended because the next line of code has no indentation.

Re: Introduction to Clojure

#8
post #7
post #6

Earlier quoted context omitted.

Interesting, since it is actually in some ways easier to see which closing paren goes with which opening one. My 'C' parser keeps telling me 'wrong bracket' though :)

Yes, which is why it is a newbie signal. A Lisp programmer with more than about three weeks of experience doesn't look at parentheses or try to match them up with each other. You know the function has ended because the next line of code has no indentation.

which suggests the use of a 'close all open parens' token to cut down on all the )))))) stuff at the end of a line, which can get really tedious, especially when editing in 'dumb' editors.

Re: Introduction to Clojure

#9
post #8
post #7

Earlier quoted context omitted.

Yes, which is why it is a newbie signal. A Lisp programmer with more than about three weeks of experience doesn't look at parentheses or try to match them up with each other. You know the function has ended because the next line of code has no indentation.

which suggests the use of a 'close all open parens' token to cut down on all the )))))) stuff at the end of a line, which can get really tedious, especially when editing in 'dumb' editors.

That's not much help when you want to close all but one or two.

The solution is to use the right tool for the job. Emacs has something called paredit-mode that relieves you of having to type the closing parens.

Re: Introduction to Clojure

#10
post #9
post #8

Earlier quoted context omitted.

which suggests the use of a 'close all open parens' token to cut down on all the )))))) stuff at the end of a line, which can get really tedious, especially when editing in 'dumb' editors.

That's not much help when you want to close all but one or two. The solution is to use the right tool for the job. Emacs has something called paredit-mode that relieves you of having to type the closing parens.

Someone should make a really good course to 'bridge' from being an experienced PHP, Perl, Java or Python programmer to that same level of competence using Clojure.
Post reply on HN