6 Replies - 1669 Views - Last Post: 20 August 2010 - 01:51 PM

#1 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Why Clojure

Posted 18 August 2010 - 11:17 PM

Recently, I posted this: http://www.dreaminco...in-parentheses/ because a couple of people were asking the typical question anyone asks when they first hear about a new language "Why would I want to use/pay attention to this language?". It's a reasonable question, and I tried to answer it in that blog post. I think I did a relatively decent job at introducing the language.

This blog post was posted today, and I saw it on reddit. It's a pretty interesting complement to my own post, so I thought I'd post it here. Also, more interesting, is that it's from a guy with 30 years of experience coding in what is considered The Typical Languages. Languages like C, C++, and Java.

It's a brief post, so it wont waste much of your time. Enjoy: http://thecleancoder...hy-clojure.html

Is This A Good Question/Topic? 2
  • +

Replies To: Why Clojure

#2 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 786
  • View blog
  • Posts: 7,618
  • Joined: 05-May 05

Re: Why Clojure

Posted 20 August 2010 - 12:22 PM

I love playing with Clojure, but having a functional language on top of a JVM on top of actual machine code doesn't exactly scream PERFORMANCE! to me. However, doing it hardcore (my preferred method) isn't for everyone and this could help. Especially when you understand the heavy performance hit of a simple 3 line algorithm in functional program VS. a carefully designed dynamic programming approach. Sometimes the functional algorithm runs exponentially slower, or uses exponentially more resources vs. O(n*n)!

The guy in the post somehow sounds more of a functional fanboy than you though, I don't know about the bias in his post. I think people should just be more creative, there's no substitute for understanding the idea of multicores. I remember there being really old supercomputers which were just hundreds of smaller processors. Even the Atari Jaguar had lots of random kinds of processors that programmers had a hard time using.

I praise Clojure for being one of the more functional languages that have more practical use and for its ability to mix with JAVA. I like languages that let you paradigm shift. However, Clojure is far from any sort of panacea to a multicore problem. It's tricky and sometimes generates annoying sometimes-happening bugs, but it's not difficult if you understand what's going on.

This post has been edited by WolfCoder: 20 August 2010 - 12:23 PM

Was This Post Helpful? 4
  • +
  • -

#3 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Why Clojure

Posted 20 August 2010 - 12:33 PM

The guy in the post is pretty well known. I believe he's actually only recently entered his "omgfp" phase. If he sounds like a fanboy, it's probably because the initial euphoria brought on by Clojure hasn't worn off yet. ;)

Indeed, Clojure is somewhat slower than Java most of the time, but obviously it only matters when it matters. There are a lot of neat and easy tricks to get more speed, and Clojure will be getting better primitive support in 1.3 which will help in that area as well. It *is* possible to make Clojure as fast as Java, but that usually requires sacrificing some important benefits of Clojure.

If I needed serious speed, I'd probably use C, OCaml (just because I haven't done anything with OCaml, surprisingly), or ooc, just because.

EDIT: It might be relevant to note that Clojure can jump headfirst into Java-land and go as far as to let you work with mutable Java arrays and all that noise as well. Like I said, there are some interesting ways to get speed, not all of them pretty. The JVM is pretty fast for a VM, but real speed is still a job for native languages.

This post has been edited by Raynes: 20 August 2010 - 12:39 PM

Was This Post Helpful? 0
  • +
  • -

#4 dorknexus  Icon User is offline

  • or something bad...real bad.
  • member icon

Reputation: 1256
  • View blog
  • Posts: 4,618
  • Joined: 02-May 04

Re: Why Clojure

Posted 20 August 2010 - 12:35 PM

Great read. Now I'm really intrigued by Clojure.
Was This Post Helpful? 0
  • +
  • -

#5 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 786
  • View blog
  • Posts: 7,618
  • Joined: 05-May 05

Re: Why Clojure

Posted 20 August 2010 - 12:36 PM

I'm always about speed, it wasn't that hard to make a multicore game engine that would handle my entities across different cores in C. The hard part is when you have a previously linear engine and you try to change it to be multicore. I'd say don't worry about it, you're relying on your video card to do all the insane things anyway. Save the multicore work for future engines.

This post has been edited by WolfCoder: 20 August 2010 - 12:36 PM

Was This Post Helpful? 0
  • +
  • -

#6 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5905
  • View blog
  • Posts: 12,808
  • Joined: 16-October 07

Re: Why Clojure

Posted 20 August 2010 - 01:32 PM

I've never had any cause to use Lisp, either professionally or for play. I've read the first fifty pages or so of the "wizard" book before. It's quite good, but at the time I couldn't think of where I'd use Lisp over any of the other applicable choices.

Now I fear I may actually be interested in looking at Clojure.
Was This Post Helpful? 0
  • +
  • -

#7 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Why Clojure

Posted 20 August 2010 - 01:51 PM

Lisp is an acquired taste. You don't understand why people are so passionate about it until you use it and experience things like macros and the full extent of it's power first hand. There really isn't anything like Lisp macros in other languages. There are similar things, but never to the ease and extent of Lisp.

Obviously, Clojure isn't the end all be all of programming. It isn't going to make you decide to never use another language again. But it's definitely worth looking at, if only to know a Lisp and to understand why Lispers love it so much. It's a wonderful tool to have in anyones tool box.

This post has been edited by Raynes: 20 August 2010 - 01:53 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1