Live data from Hacker News

Why I am excited about Clojure

blog.txus.io

51–60 of 173 posts

Re: Why I am excited about Clojure

#51
post #34

Earlier quoted context omitted.

That's the neat thing about Lisp-style macros. You have to sacrifice a little bit of the syntactical sugar that you are used to in most languages, but in return you have the ability to add almost any possible construct to the language natively. It makes it much easier to extend the language as you don't need to hack an interpreter written in C or Java. Half of the core language is already written in macros.

Not having to memorize an operator precedence table makes me more than willing to give up syntactic sugar. This is one of the things that I dislike most about haskell. I wish liskell or one of the other projects trying to bring S-expressions to haskell had taken off.

>Not having to memorize an operator precedence table makes me more than willing to give up syntactic sugar.

Really? This is such a big problem that you have to choose a completely different language.

Re: Why I am excited about Clojure

#53

I am a Ruby guy torn between diving into Haskell or Clojure. Help! Every time I get excited about one feature of one (ClojureScript) I learn the other has something equivalent or potentially better (Haste). One thing that has put me off on Clojure is 1) the ugly as hell JVM stacktraces, 2) hitting the wall of the number system results in nasty JVM errors if you are used to Ruby's trivial (to the developer at least) h…

General advice: don't let the desire to learn the "right" thing prevent you from learning, period. Eventually, it's better to just make a choice and dive in, then to spend more time trying to figure out which one is "better".

Re: Why I am excited about Clojure

#54
post #36

The reason I end up with Python, CoffeeScript or Ruby and not a Lisp is the prefix notation and the parentheses. The parentheses can decrease readability and the prefix math expressions can make the order in which you think up a solution awkward. http://sourceforge.net/p/readable/wiki/Problem/ http://cs.brown.edu/~sk/Publications/Papers/Published/mfk-va...

I have done quite a bit of Python hacking, as well as Javascript and Ruby. You really do get over the parentheses thing. In fact it more or less becomes a non-issue after a few days. It just is not something that should make you decide against a language.

The only time it becomes a major issue is if you are nesting many functions, but in that case the threading function is both utilized often and quite elegant.

Instead of:

    (fun3 (fun2 (fun 1 "string")))

    (-> "string" fun1 fun2 fun3)

Re: Why I am excited about Clojure

#55
I'm a C# guy at work, I also do some front-end in javascript (with angularjs sometimes). For side-projects I like to use node.js. I want to learn another language, and I've been wondering wether I should go with Clojure or C++ ? My dilenma is "Do I want to learn more about programming style running on VMs (functional) or do I want to dive into barebone high performance code ?"

I've done C and Java at university, but that was a while ago.

Anyone has a comment?

Re: Why I am excited about Clojure

#56
post #20

Earlier quoted context omitted.

Oddly enough I never used this, but maybe named fns might help? ( http://clojure.org/special_forms#Special%20Forms--%28fn%20na... ) (fn my-name [] (throw (Exception. "boom"))) (Sorry, I don't know Clojure internals well enough to have great answers to your explicit questions.) [Edited: thanks to jerf for pointing out the inconsistency in a term I used.]

Named... anonymous... functions? Wuzzah fuzzah?

Just like in Javascript.

Re: Why I am excited about Clojure

#57

Man. I know Lispers hate hearing about it, but I was so on board with this until the sample ClojureScript code and all the parens. I just… don't wanna write code like that.

Something that may make it easier to accept all the parens is that that very thing is part of what enables some of the good stuff. You're essentially writing your programs directly as an AST (abstract syntax tree, http://en.wikipedia.org/wiki/Abstract_syntax_tree). That is what makes it so natural to write macros that manipulate your own code on the same level that a compiler does.

That realization may not make the code any easier to read at first, but it may make it easier to accept it.

Re: Why I am excited about Clojure

#58
post #26
post #13

Earlier quoted context omitted.

They both have same roots, the :keyword syntax comes from Common Lisp and others: From Matz (creator of Ruby): Ruby is a language designed in the following steps: * take a simple lisp language (like one prior to CL). * remove macros, s-expression. * add simple object system (much simpler than CLOS). * add blocks, inspired by higher order functions. * add methods found in Smalltalk. * add functionality found in Perl (…

If you remove macros and s-expressions from a simple lisp.. what remains? Genuinely curious. If I'd had to guess I say just the spirit of the language, the macros being reincarnated as the highly dynamic smalltalk method system. The s-expressions being reincarnated as the blocks.

> If you remove macros and s-expressions from a simple lisp.. what remains?

java script :)

Re: Why I am excited about Clojure

#59
post #55

I'm a C# guy at work, I also do some front-end in javascript (with angularjs sometimes). For side-projects I like to use node.js. I want to learn another language, and I've been wondering wether I should go with Clojure or C++ ? My dilenma is "Do I want to learn more about programming style running on VMs (functional) or do I want to dive into barebone high performance code ?" I've done C and Java at university, but…

Did you take a look at F#?

Re: Why I am excited about Clojure

#60
> the language tries to drive me to the cleanest solution

This is really appealing to me. I've hacked a bit with Ruby (One Month Rails and some other tutorials), but I'm not sophisticated enough to know instinctively how to refactor towards "clean" or "elegant." Most of my code is pretty ugly, and gets uglier the longer I work on it, since when I'm hacking on something without guidance I spend a lot of time just trying not to break things. Is there a good resource for a non-programmer to start learning Clojure? The syntax is a bit scary to me, but I just think back to when I first learned about programming and figure diving in will eventually make it read more sensibly to me.

Also, being connected to a live REPL seems pretty valuable for learning.

Post reply on HN