18 ms·
Why I am excited about Clojure
- dopamean 12y agoWhat is it about Clojure that Rubyists love? I am a Rubyist who is new to Clojure (I love it) and I cant explain it myself. Clojure was suggested to me by several other Rubyists. I find myself suggesting it to other Rubyists as well....
- krat0sprakhar 12y agoI'll go out on a limb and say that everyone on HN loves Clojure! It seems to be the least cribbed language here. Its features are hard to beat - that and Rich Hickey's wonderful talks[0] make you all the more confident in Clojure as a language! [0] - http://www.infoq.com/author/Rich-Hickey http://www.infoq.com/author/Rich-Hickey
- jacquesm 12y agoIn a community of several 10's of thousands of people saying 'everyone' is always wrong. To love clojure you'd have to first become proficient in it and I highly doubt even double digits of HN would claim to be proficient, much less to love the language. In general, you speak for yourself and yourself alone and my take from your comment is that you love clojure. I have played around with it but not enough to be able to say that I love it, even though I would like to spend more time with it. I'm sure that when the honeymoon phase is over clojure will be yet another useful tool in the toolbox. I can't recall a single language that I truly love, they all have their specific warts and I expect clojure to be no different in that respect. Just a different set of limitations to applicability.
- coldtea 12y ago>To love clojure you'd have to first become proficient in it and I highly doubt even double digits of HN would claim to be proficient, much less to love the language. I'm pretty sure many times more than 99 HN people have used Clojure extensively. Heck, there have been posts here from teams using it in production on their startups.
- jacquesm 12y agoApologies, I meant that as a percentage, not as an absolute number.
- astine 12y agoTo love clojure you'd have to first become proficient in it... I do not think that the GP was using 'love' in that sense. You can 'geek out' about news and information about something without actually being much involved in that something at all. Witness the popularity of posts about space launches on HN. I doubt that there are very many actual rocket scientists, but we sure do have a lot of people interested in progress made in space.
- jacquesm 12y agoLove for space travel and love for a programming language are two different things entirely, the one is an adventure on an almost trans human scale the other is a way to tell a computer what to do.
- aaronem 12y agoSpeaking as someone who has lately been studying Common Lisp, I'm not quite sure how I feel about Clojure; I like that it's hosted on the JVM, but I don't like the apparent lack of a debugger, which to my mind is a sine qua non of Lisp development. I haven't seen much in the way of progress on that front, either, but it's been a few months since I last looked into it; is there any sign that that handicap is likely to be repaired?
- lemming 12y agoI'm the author of Cursive, a Clojure IDE based on IntelliJ. Cursive currently has a fairly minimal and occasionally frustrating debugger that I'm planning to improve soon. That said, I use it all the time and it works pretty well. It's really nice to be able to debug a REPL session. Currently breakpoints and stepping work well, and expression evaluation somewhat works but is pretty quirky. Types and names are all currently displayed as Java, unfortunately. I'm planning to have a debug REPL per stack frame when I get around to upgrading this part. I'm hoping to get to this sometime within the next month.
- aaronem 12y agoWell, I'm glad to see that you at least appear to be headed in more or less the right direction. I'm not about to invest $100 in Clojure at this early stage of the language's development, but I'll be interested to see how the tooling continues to progress.
- theorique 12y agoAt a fairly superficial level, the :keyword syntax seems reminiscent of Ruby. But I'm neither an expert Rubyist nor Clojurist (Clojurian?) so I would defer to those more familiar.
- dopamean 12y agoThere are quite a few things in Clojure that are similar to Ruby. nil? empty? and count all do in Clojure what you'd expect from Ruby. take-while, drop-while are a couple other examples.
- willismichael 12y agoThe funny thing is that the reason for the similarity is that Matz "borrowed" most of those features from older lisps.
- nabla9 12y agoThey 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 (in OO way). So, Ruby was a Lisp originally, in theory. Let's call it MatzLisp from now on. ;-)
- tinco 12y agoIf 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.
- nnq 12y agoIt remains something that people living on a strict OOP+procedural+Algol-like-syntax only are willing to swallow. ...otherwise they'll just go "yuuuck!" or "wtf?" or "this is weird" and walk back away to their cubicles. Ruby is great because it changed the culture by letting the kinds of people that wouldn't have dabbled in functional-ish programming or DSLs put their toes in the meta-water ...now hopefully, some of them will start to take swimming lessons :) (and a few will drown themselves and their friends, of course, but there are prices to pay for enlightenment)
- Elrac 12y agoI'm not exactly a Rubyist, but I really like Ruby. One of the things I like about it is its orthogonality: the concepts you learn work identically or similarly in different places, for different object types (where possible) so a relatively small handful of syntax + ideas + the library docs give you a running start at any program. The same applies to Clojure. There's laughably little syntax to learn, and once you've got that under your belt you're just composing functions. I'm not made to feel I've wasted a lot of memory space on the esoterics unique to some particular language. Clojure works for me rather than the other way around. This no-nonsense obviousness was one of Matz' design goals for Ruby, and clearly ditto for McCarthy and Hickey.
- bkurtz13 12y agoThis is called homoiconicity[0] and it's one of Clojure's coolest features in my opinion. [0] http://en.wikipedia.org/wiki/Homoiconicity http://en.wikipedia.org/wiki/Homoiconicity
- dopamean 12y agoThe concept of homoiconicity has yet to really sink in for me. Conceptually, I understand what it means and I can explain it to others but I have yet to really understand it in a practical sense.
- samatman 12y agoImagine if, instead of Javascript, you had a language based on JSON, with a few additional types, notably a 'symbol' type and a 'list' type. A few of the symbols are primitives that determine the semantics of the list type, allowing other symbols to be defined as functions. That's homoiconicity, and Clojure strongly resembles an actual implementation of this conceit.
- nahname 12y agoI love learning, especially how to write succinct clean code. Clojure, like ruby, scratches that itch and is fun to work in. It feels written with the intent of making programmers lives easier through mastery.
- adamors 12y agoWell, I think it's because Ruby has borrowed a lot of features from Lisp (and Clojure is also a Lisp). Here's an article that argues that it is actually an acceptable Lisp: http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-a...
- VLM 12y agoThey have a similar taste, one of many examples is both are dynamic typed. There's at least some LISP ancestry for both (more for Clojure obviously). As for differences I like Clojure because I can compile up an uberjar and hand that uberjar to ops and walk away, so its faster and easier, whole regions of "fun" (In the dwarf fortress sense of "fun") that exist in ruby deployments simply don't exist as a class of problem in clojure deployments.
- mattgreenrocks 12y agoI'm learning Clojure, and my favorite thing so far is that the Clojure community's idea of engineering is substantially better than Ruby's. For example: * immutability by default * decoupling by default * small libraries rather than mega-frameworks The comparison is not quite fair; but there's something to be said for appreciating a well-engineered solution versus the usual "SHIP FASTER, PEON!" schtick that Ruby has.
- dopamean 12y agoI think the SHIP FASTER PEON! thing has less to do with Ruby and more to do with the perception that Ruby is some magical tool with which you can rapidly build anything. I learned Ruby 100% on my own and never worked with anyone else who used it and I've found my approach to writing Ruby very similar to my approach to writing Clojure: decoupling by default, immutability by default (where possible), single use design for methods. It wasn't until recently that I learned that what I do naturally in programming has an entire school of thought behind it called SOLID design. I definitely agree that Clojure lends itself more to following SOLID design principles but I think that Ruby can as well.
- the_watcher 12y agoI remember reading one of PG's essays about Lisp being the most powerful language, and he made a list of characteristics defending his position. He implied that the new languages that are becoming popular simply move closer to being a Lisp. My guess is that Clojure is the Lisp that emerges most directly from someone who learned about languages from Ruby. I've only ever hacked with Ruby, if I can find a good intro series for non-coders to Clojure, I'm going to dive into it.
- hibikir 12y agoLisp has a lot of strengths, don't get me wrong. But it is an ancient language, and despite its age, it never managed to catch on in a big way. It is true that many more popular languages keep stealing Lisp concepts, but that doesn't tell me that Lisp is amazing, but that despite all of its strengths, it must have some terrible weakness that makes it relatively uncompetitive in the general programming population. My opinion is that it crosses a syntactic threshold of abstraction, after which a language just loses. s-expressions are extremely powerful, but also the language's Achilles heel. This resembles how there is a 'happy medium' for writing human languages. We could write all of our text in morse code, but we don't. We know that too many glyphs, like in Chinese, slow down learning too, as the effort to remember them all takes lots of practice. So just like Scalaz's operators are so arcane that us mere mortals are better served by using words instead of <=o=>, a world of s-expressions makes it harder to find your way precisely because of excessive syntax homogeneity. Still, I think Lisps are worth learning, it's just that I think the ideal language steals much from Lisp, including most of what s expressions are used for in practice, but it doesn't go all the way.
- danneu 12y agoI also went Ruby -> Clojure. Ruby appealed to me because of its simplicity and conciseness, but after a couple years it turned out to actually be rather complex. I found the simplicity and conciseness I was looking for when I was randomly reading some Clojure code a couple years ago in the speclj sample docs (http://speclj.com/tutorial/step7 http://speclj.com/tutorial/step7) of all things.
- elwell 12y agoRich Hickey (creator of Clojure) was/is a big Ruby user.
- richhickey 12y agoI am not, and have never been, a Ruby user.
- deleted 12y ago[deleted]
- john2x 12y agoI'm a Python user and I love Clojure. I guess I missed the Go bus. But there's 2 things about it I'm not too fond of. One is due to it's declarative nature (which I love), it's quite difficult to get up to speed with unfamiliar code. The 2nd is due to it's JVM roots. Those stacktraces, man. And when it happens on an anonymous funtion in a not so documented library, ugh. It's like hitting a brick wall. The first, I can deal with enough practice and Schema/core.typed. Is there any hope for the stacktraces to improve? How do other JVM based languages fare in this regard?
- calibraxis 12y agoOddly enough I never used this, but maybe named fns might help? (http://clojure.org/special_forms#Special%20Forms--%28fn%20name?%20%28[params*%20]%20exprs*%29+%29 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.]
- jerf 12y agoNamed... anonymous... functions? Wuzzah fuzzah?
- weavejester 12y agoThey allow you to use recursion without the need for a Y-combinator.
- larholm 12y agoJust like in Javascript.
- awj 12y agoYeah, that's a terminology issue. They mean lexically scoped named functions. Versus the default in Clojure of global or namespace scope.
- 12y ago
- lectrick 12y agoI 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) handling of numbers of any size, 3) the time it takes to fire up the JVM itself (I like really fast really instant unit tests) On the other hand, what has put me off on Haskell is that 1) all its users seem like mathematics professors, 2) a lot of its libraries will fail to compile when combined with each other without a lot of hand-holding and carefulness
- jhh 12y agoI'll try to dispel some of the concerns about Clojure. 1) Stacktraces in JVM may be ugly, but the amount of insight into runtime issues that the JVM offers you is generally way higher than in runtimes like cpython or MRI. 2) Clojure gives you a rather elegant way to work with the different JVM number types as it offers literals for those. I think Java Longs (the integer default) should be long enough as it's a 64 bit value. And on the floating point side the default is a double, which also seems nice to me. See: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html http://docs.oracle.com/javase/tutorial/java/nutsandbolts/dat... Above this Clojure offers BigDecimal literals and native ratios. 3) The startup time is gigantic. However, while developing you usually should not have to restart the JVM as you can update the JVM with new bytecode through the REPL. This should also dispel the concern about unit tests (although I'm not sure you can reach the necessary speed, if you talk about < 0.5 second unit tests, because the code needs to be compiled to JVM bytecode 1st. There's definitely still potential there.
- astine 12y agoThat last feature is certainly one of my favorite parts about Clojure. It's one of my favorite parts about Lisps in general actually, but Clojure has a very good handle on it. Having to compile a program before seeing if the changes you made work can be a nuisance. Interpreted programs are slightly better, but being able to make micro-changes to a running instance of a program and seeing in real-time how it affects the whole program is the best. The feature that Clojure misses here is the ability to load new libraries (jar files) on the fly, but that's not Clojure's fault, but rather the JVM's fault.
- spacemanmatt 12y agoI could load jars on the fly in Java.
- skj 12y ago> Having to compile a program before seeing if the changes you made work can be a nuisance. Not being able to compile a program to check if the changes you made are even coherent is also a nuisance. Also, nothing says that compiling a program has to take a long time (eg. go).
- undershirt 12y agoI'm more excited about ClojureScript because it runs in the browser as JS, of course. My mind is kind of blown that Go-routines were added to the language as a library (core.async). And so was logic programming (core.logic), optional typing (core.typed), and pattern matching (core.match).
- astine 12y agoThat'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.
- seacious 12y agoNot 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.
- dominotw 12y ago>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.
- seacious 12y agoKnowing what the AST looks like without having to sit an think about it is huge. Maybe you're smarter than me and can instantly intuit it, but I think most people can't. I think that this is one of the reasons that macros are so widely adopted in LISPs but not in other languages that support them. Having an immediately evident AST makes it much easier to reason about, and hence to manipulate either through code or manually. Edit: Improve clarity.
- krstck 12y agoI'm also mostly a Rails dev in my day job but have been exploring Clojure on my own. I've found myself writing out functions in Clojure first before porting them to Ruby. I'm very pleased with the quality of the Ruby code I've produced after doing this.
- erokar 12y agoThe 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://sourceforge.net/p/readable/wiki/Problem/ http://cs.brown.edu/~sk/Publications/Papers/Published/mfk-val-grow-tree-expr-integ-fp/paper.pdf http://cs.brown.edu/~sk/Publications/Papers/Published/mfk-va...
- wging 12y agoI'd argue they're only "awkward" because you aren't used to them.
- Expez 12y agoThe benefits of lisp 'syntax' are legion, to the point that I've come to feel that your position is unprofessional. Why wouldn't you try to get passed something as superficial as syntax, in order to better _make_ stuff? 1) Easier to learn and remember syntax for polyglots. No more Googling, shit like "what was the syntax for try-with-resources or the new multi-catch feature in java"? 2) The language tooling is so much easier to get right. The parser for Ruby is 10k lines. What the actual fuck? How can you expect people to make good tools if they can't get past the parse step? 3) Macros! 4) No fucking precedence rules. I don't want to memorize that the precedence for 'and' and && is different in Ruby and how 'and' interacts with the precedence of other operators like assignment. 5) Structural editing. I might have forgotten a few, but 2) and 3) alone are killer features.
- tomp 12y agoJulia [1] has 3 and 5, and almost 1 (it has very few built-in syntax sugars and a uniform way of invoking macros). It's targeted at scientists, so 4 is not an option, as infix syntax is a hard requirement for mathematics. [1] http://julialang.org/ http://julialang.org/ Edit: Elixir [2] is homoiconic as well, with even more uniform syntax (though it doesn't have special matrix syntax). [2] http://elixir-lang.org/ http://elixir-lang.org/
- badman_ting 12y agoMan. 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.
- scott_s 12y agoSomething 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 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.
- eccp 12y agoI felt the same way as you until I actually tried Clojure. In a few hours all my rejection of the parens dissapeared because I finally understood. Try solving a small problem in Clojure (a code Kata, or a problem from Project Euler) and you'll see those aprehensions against the parens will go away. Nowadays I'm having trouble to accept the syntax of other languages, eg. Scala :-)
- deleted 12y ago[deleted]
- erichmond 12y agoEverything in life a tradeoff. You should watch this video: http://www.infoq.com/presentations/Simple-Made-Easy http://www.infoq.com/presentations/Simple-Made-Easy The parens are annoying, until: a) You build that fully composable library that you always wished you could have written in X language, but it neeeeever quite worked the way you wanted. b) You realize that by keeping your data immutable, it allows you to write less tests, be more confident in your code, and you stop worrying "is that value is what I think it is?" c) By building on top of the JVM, you are able to use java interop to save yourself a day of coding a custom library for something that exists and is well tested. d) Deployment becomes a breeze because you just export a jar/war file and load it up into any of the existing app servers. e) You get phenomenal speed increases for "free" if you're coming from dynamic languages like ruby/python/PHP f) When you need to dip into async code, you can write your async code, in a synchronous fashion, which (for me) is much easier to think about then keeping track of callbacks in my head. Good luck, if you decide to give it a shot, I think you might realize the parens isn't such a big deal in the long run!
- nilved 12y agoI'd heard from other Ruby developers that learning Clojure is difficult but ultimately rewarding. That was my experience as well. All of my side projects are written in Clojure.
- guiomie 12y agoI'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?
- eronhp 12y agoDid you take a look at F#?
- guiomie 12y agoYes, but I'd like to get off the CLR.
- platz 12y agoI'm a C# guy at work too. I can't say I've touched much C++ outside of college also a while ago, but I've been studying functional programming for a while and really enjoying the new concepts it teaches. It can be a bit humbling at times though. I got some good perspective with https://www.coursera.org/course/proglang https://www.coursera.org/course/proglang and you could do worse than taking grossman's excellent course. It helps to have some structure and a schedule when starting imho. I will admit at times I wish I had more chops (closer to the metal i.e. C or C++), but I think I was eventually just more interested in new ways to think about programming, and I'm not sure I'd get the same pleasure out of digging back into C++. Obviously, if you know something more about your intended use case (i.e. you want to program games), you can make a more informed decision.
- visarga 12y agoFor some reason the Programming Languages class is offline now.
- 12y ago
- the_watcher 12y ago> 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.
- nonrecursive 12y agoClojure From the Ground Up http://aphyr.com/tags/Clojure-from-the-ground-up http://aphyr.com/tags/Clojure-from-the-ground-up is a good resource, and there's also my own Clojure for the Brave and True http://www.braveclojure.com/ http://www.braveclojure.com/ . I actually started by going through "Land of Lisp" first. Though it covers common lisp, not Clojure, it's a very fun book. edit: Realm of Racket is also a good lisp book, and a lot of people like "the little schemer". It's hard for me to say how good these are for people completely new to programming, though. Finally, there's the ClojureBridge curriculum, which is targeted at new programmers: https://github.com/ClojureBridge/curriculum https://github.com/ClojureBridge/curriculum
- the_watcher 12y agoThanks, I'll check them all out. I've been playing with languages for a few years now and built some really tiny, throwaway stuff. I'd say I grasp the basic concepts of programming pretty well (by basic I mean the very basic), but I still very much feel new to programming. I started with Ruby because it's accessible, but ever since I've learned about them, I've wanted to eventually learn a Lisp.
- tomp 12y ago> With Clojure your editor (be it Vim, Emacs, Light Table...) is permanently connected to a live REPL. You continually develop, test and modify functions with subsecond feedback. Continuously. Can anyone explain or point me in a direction where I can learn how the above functionality is actually used and useful? I keep hearing about live-editing/hot-reloading, and in theory I believe it must be very useful, but I cannot concretely imagine how it would be used in practice. What kind of programs can work like that? Continuously running programs, like web servers/GUI programs? So what happens when you change a function? Do you manually simulate a web-request? Rerun unit tests? Would it work with command-based pipelined programs, such as compilers as well?
- malvosenior 12y agoThe beauty of Clojure (and all functional languages) is that everything your app does is made of very small functions composed together. You wouldn't really simulate the round trip http request via the REPL but you can change and test idempotent functions independent of each other. Most Clojure functions are under 15 lines of code. You can also mess around with transforming state that you may have stored in an atom...
- mattgreenrocks 12y agoIt's a side effect of decoupling. If you don't need to pass the world in to a function, then it is much easier to poke at. I played with Clojure making a simple pong game, and used this to work on collision detection. I worked on a function called rect-intersects that took in two rectangles. It was much faster to work on than if I'd booted up the game each time.
- patrickmay 12y ago> What kind of programs can work like that? Continuously running programs, like web servers/GUI programs? I use Common Lisp and Hunchentoot to build RESTful web applications. I can connect to the Lisp image running on the server using Swank from Emacs on my development box. If there is a bug, I can change the function, recompile it, and test the change with curl, without rebooting the server or reloading the app. The same techniques work for adding new functionality and APIs. I suggest just giving it a try. It'll change the way you think about building systems.
- pk2200 12y agoI'd like to learn Clojure. Any suggestions on how to get started? It's my first time using a Lisp dialect. I figured I'd tackle the Clojure Koans, and mix in a few Project Euler problems. I'd also like to do some code reading. I know the Clojure source code is on GitHub, but maybe something smaller to start? If anyone else is interested in getting started, here are a few links I visited over the weekend: http://www.braveclojure.com/do-things/ http://www.braveclojure.com/do-things/ http://aphyr.com/tags/Clojure-from-the-ground-up http://aphyr.com/tags/Clojure-from-the-ground-up http://clojurekoans.com/ http://clojurekoans.com/ http://youtu.be/wASCH_gPnDw http://youtu.be/wASCH_gPnDw The last link is an hour-long interview with Rich Hickey - a fantastic introduction to the language and his design goals. It's probably the best technical video I've ever watched on YouTube.
- Totient 12y agoClojure feels like a 'compromise' Haskell, but I mean that in a good way. Haskell really wants to pretend that everything is a pure function. But I think this is a case where the conceptually simpler thing (i.e. no state) is just too hard to reason about. Clojure backs off the 'referential transparency ONLY' philosophy, and merely discourages mutability. In my (limited) experience, this gives almost all of the advantages of Haskell, but an environment that's easier to program in. So yeah, I'm excited about Clojure too. I just wish we could port it off the JVM...
- m0a0t0 12y agoYou can still do state using the state monad. > this gives almost all of the advantages of Haskell except one of the biggest ones - the type system. Obviously this is subjective though. Some people prefer dynamic typing :)
- tieTYT 12y ago> When I start using a language, there are usually some situations where I can't understand why my code isn't doing what I expect it to do. When that happens to me in a language like JavaScript, for example, finding out what the problem was is generally a very frustrating experience This is a very weird paragraph to me because I've experienced the exact opposite. You can see my frustration in this stack overflow question I titled "How do I get better feedback from Clojure errors?": http://stackoverflow.com/questions/16901836/how-do-i-get-better-feedback-from-clojure-errors http://stackoverflow.com/questions/16901836/how-do-i-get-bet... While I agree that JavaScript has tons of "Wat" quirks that shouldn't be there, I rarely run into them. And more importantly, when I get errors in JavaScript, the cause is relatively easy to track down. With Clojure on the other hand, it is really difficult for me to figure out why I'm getting the error. Yes, I get the error because I "was doing it wrong", but the errors don't help me figure out what I was doing wrong. ------------- > With Clojure your editor (be it Vim, Emacs, Light Table...) is permanently connected to a live REPL. You continually develop, test and modify functions with subsecond feedback. Continuously. All the cores in your brain are lit, as you have literally no time to think about anything else. That's not only deeply satisfying, but also leads you to certain thought paths that slow feedback and its inevitable lower focus would have simply blocked. That's one of my favorite parts of Clojure. This is very useful when you're writing new code, but I found myself scratching my head when I had to go back and modify already existing code to add a feature. As a workflow, I don't "get" when/how you're supposed to add automated tests when you're using REPL driven development. But, once I went back to my code, I always wished they were there. You see, I'd modify the code and break something and then the problem I described above made fixing it very time consuming. Usually the cause of my problem was my simple functions wouldn't integrate together the way I expected. The REPL gave me the quick feedback to say that "increment-number" worked, but I would accidentally pass in a String or a vector into the function.
- coolsunglasses 12y agoI've done a lot of Clojure. For iterative/REPL-driven development I find Haskell a lot more pleasant. The types drive how I think, provide way-way-way better feedback on mistakes, and provide a new modality for querying my code in the REPL. As a bonus, the UX to ghci is better than using nrepl/cider in Emacs. Reload "just works" and works more quickly than reloading namespaces in Clojure. I was gobsmacked when I saw how much better ":r" worked in ghci than reloading in the Clojure REPL.
- m0skit0 12y ago> Plus, whenever some interface I've built feels awkward or there's some duplication, often times I find that, while thinking and trying to refactor it, the language tries to drive me to the cleanest solution Yes, this is my exact feeling when I'm still learning it :)