5 ms·
Clojure.
by cema 17y ago
Clojure.
- charrington 17y agoI 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.
- cema 17y agoAgree on all points.
- radu_floricica 17y agoJust 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.
- swolchok 17y agoI 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.
- radu_floricica 17y agoI 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.
- swolchok 17y agoOK, now you want to develop a desktop version of your application with a snazzy graphical interface. Good luck.
- pavelludiq 17y agoMe 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).