News for hackers. Stuff that matters.
Re:Ask HN: What programming language are you currently learn... by cema on Saturday July 04, 2009 @05:24PM (#687586)
Clojure.
Re:Ask HN: What programming language are you currently learn... by charrington on Saturday July 04, 2009 @05:48PM (#687614)
I am learning Clojure because I know lots of "traditional" languages and want to stretch my brain in new ways. I am also interested in new ways to write parallel programs, which is becoming a bigger and bigger issue. Clojure scores well on these two criteria. I chose Clojure over Scala and Haskell, because I believe in dynamic typing over static typing. This is probably more an issue of tase than anything and I also have a high opinion of those static languages. I am very impressed with Rich Hickey's design sensibility and his goals for Clojure align well with my own.
Re:Ask HN: What programming language are you currently learn... by cema on Monday July 06, 2009 @12:43PM (#689925)
Agree on all points.
Re:Ask HN: What programming language are you currently learn... by radu_floricica on Saturday July 04, 2009 @06:56PM (#687672)
Just wanted to say it's hard. I'm definitely not the best programmer, truth be told I haven't even programmed full time for a while, but switching from java to clojure took me at least half a year.

I'm in the middle of my first (small) full app though, and I can tell it will be worth it. With java there was a wall in productivity I simply could not brake. I wrote pieces of code sometimes as fast as I could type (similar alterations to existing software), but still I felt I did the same thing over and over again. Now I'm at the first iteration of my framework and I can already tell a lot of the code I write won't be written again.

Just an example: one of the first things I did was to brake the old web convention of separating the app into writing html and processing requests. Most of the links I write now, including forms, have the action code right there. Something like (pseudocode):

  html_button("Delete item", {
    delete_item(value); 
    return list_items();});
I'm not saying it's the way to go with a webapp, only how easy it is to experiment with different paradigms.
Re:Ask HN: What programming language are you currently learn... by swolchok on Saturday July 04, 2009 @07:51PM (#687738)
I would not advise this style of programming, because it creates a very tight binding between the application logic and the interface. In fact, it's exactly the problematic style caused by GUI builders that generate event handlers and ask you to fill them in.
Re:Ask HN: What programming language are you currently learn... by radu_floricica on Sunday July 05, 2009 @03:37AM (#688026)
I think clojure's use of higher order functions is very well suited for this. With only a "#" in front the code becomes a lambda function. This pretty much makes the whole concept of handler functions void - or at least trivial.

But I'm not sure if it will work out in the end... and I mixed this with liberal use of metadata and thrown away SQL too... mostly I try to go as far as I can and see where I trip. It's fun.

And it does make for some terse code. This for example is the code for changing the person responsible for a brief:

    (html-select (cons {:id 0 :name "- No account -"} 
		       (filter #(:is-account %) @users))
      :selected (:account brief)
      :onchangefn #(do
		     (passoc briefs (:brief %) 
                             :account (Integer/parseInt (:value %)))
		     (return-from briefs (:brief %))
      :onchangeparams (str "&brief=" (:id brief)))
And this really is all of it. No html, no sql, nothing.
Re:Ask HN: What programming language are you currently learn... by swolchok on Sunday July 05, 2009 @02:15PM (#688528)
OK, now you want to develop a desktop version of your application with a snazzy graphical interface. Good luck.
Re:Ask HN: What programming language are you currently learn... by pavelludiq on Sunday July 05, 2009 @06:48AM (#688118)
Me to, knowing a little scheme definitely helped, watching all the SICP lectures last summer also helped(If you don't have time for the book, the videos are a good way to cheat).