13 ms·
Clojure will affect the way you think about programming
- sharms 9y agoI have switched between many programming languages, and if you are considering Clojure I would highly recommend it. It is immutable first, which helps eliminate many classes of explicit bugs and non-obvious anti-patterns. It also works across Java / Javascript allowing for a common code base of business logic across all layers, and with React Native looks and performs well on iOS and Android.
- hsx 9y agoWhen you say it works across Java/JavaScript - could you expand? Can I essentially write Clojure that compiles to JavaScript?
- lostcolony 9y agohttps://clojurescript.org/ https://clojurescript.org/
- praptak 9y agoYes, that's ClojureScript.
- sp0ck 9y agoShort answer - yes. https://clojurescript.org/ https://clojurescript.org/
- deleted 9y ago[deleted]
- yogthos 9y agoClojure uses reader conditionals https://clojure.org/guides/reader_conditionals https://clojure.org/guides/reader_conditionals that allow writing code that cross-compiles between different platforms, and generates platform specific code when necessary. Many Clojure libraries cross-compile between Clojure and ClojureScript. You can see an example here https://github.com/yogthos/json-html/blob/master/src/json_html/core.cljc https://github.com/yogthos/json-html/blob/master/src/json_ht...
- agentultra 9y agoThe perfect language? I doubt that. It's probably quite decent.
- grouchoboy 9y agoThe perfect language to expand your brain. In a world dominated by java, php, c++,... In my opinion yes, Clojure could the perfect language to continue learning concepts, at same level would be Haskell.
- yogthos 9y agoIt's also very pragmatic, and probably most used functional languages in the industry at this point.
- keymone 9y agowish that were true, but i doubt it. scala, prolog and erlang are all higher on tiobe index.
- yogthos 9y agoI personally don't view Scala as a FP language, it's a FP/OO hybrid. It's not opinionated in that regard, and a lot of code in it is written in traditional OO style or a mix of the two. Erlang is another widely used functional language, but it's not very widely used outside the telecom niche. Clojure has the advantage of running on the JVM, and makes it easy to target a much wider range of domains.
- keymone 9y agoright, but technically so is Clojure - you can get your hands dirty and mutable with relative ease. Scala's problem is that they marketed it as "we're almost java - you can just sprinkle some functionalness on your code as you go and you'll be fine".
- jrs95 9y agoI just saw an article recently about core.async and the "go" macro, which seems to effectively give you goroutines in Clojure. I'd be very tempted to use it for that reason alone. I love Go's concurrency, but it can be a little on the verbose side. Good for some projects, but not all of them.
- eliben 9y agoGo is verbose? I'm surprised to hear that, to be honest. Can you say what it's verbose in comparison to? What production language/framework has terser concurrency with the same expressiveness?
- robto 9y agoClojure for one! But I thought it was a common complaint that Go's lack of support for generics and other language design decisions aimed at keeping things easy make it much more verbose. That's just a non-user's perspective on the scuttlebutt, though - I don't have any actual experience with Go.
- jrs95 9y agoI didn't mean the concurrency, just the language in general. And verbosity isn't always a bad thing. I can dive into pretty much any Go codebase and get a good idea of how it works pretty quickly, and that's been a pretty unique experience for me.
- lgas 9y agoHaskell would be an example of a language that is terser and more expressive with comparable concurrency primitives.
- abhirag 9y agoIf you are curious about core.async and want to learn more you can have a look at the post I wrote on it-- [http://abhirag.in/articles/batman_clojure.html http://abhirag.in/articles/batman_clojure.html]. I wrote it while trying to learn it myself so not the most advanced resource but I hope somebody finds it helpful :) Note -- The page is kinda resource intensive because it contains a running clojurescript interpreter for interactive code snippets.
- maehwasu 9y agolet clojure = Haskell
- extra__tofu 9y agoI'm an EE who is getting more and more interested in software development and computation in general. I've been reading Paul Graham and Peter Norvig and decided to learn Scheme. Any thoughts on Scheme vs. Clojure for learning?
- davedx 9y agoThey are both LISP dialects, therefore worth learning. Clojure(Script) is nice because it has great interoperability with underlying platforms, so it's also a very practical and useful language for the real world. But if you started Scheme stick with that first - focus.
- eliben 9y agoTo a first order of approximation, for this task it doesn't matter. Both are good options. I do recommend reading SICP while at it; using Scheme for SICP is easier than using Clojure. On the other hand, Clojure is more production-ready than most Schemes, in my experience -- this sentence being one of the reasons as the Scheme landscape is very fragmented, despite the standard(s). For example, in my own SICP journey (http://eli.thegreenplace.net/tag/sicp http://eli.thegreenplace.net/tag/sicp) I was using PLT Scheme, one of the most usable implementation back in the day. Unfortunately it forked off into a slightly different language - Racket - since then. So YMMV
- twfarland 9y agoScheme is a smaller language and has legendary beginner books. Start with HTDP and then SICP.
- peatmoss 9y agoSeconding HtDP. I have gotten lots of mileage from that one.
- cle 9y agoClojure is definitely more practical, being much more widely used in production and running on the JVM (which provides access to a huge array of Java libs). Scheme is simpler though, and probably more approachable for a beginner. The hosted nature of Clojure means you'll need a decent understanding of the underlying JVM to understand errors--the first time you get a stack trace you're going to seriously question your choice. Also Clojure's syntax is more complicated (but really, not at all complicated compared to Java, C#, Python, etc.). You should be able to pick up Clojure pretty quickly if you're already familiar with Scheme, the programming style is pretty similar.
- marklgr 9y agoWhat are the best, up-to-date books to learn Clojure for an experienced developer pretty familiar with FP?
- greenonion 9y agoProbably Joy of Clojure.
- iLemming 9y agoJoy of Clojure arguably not very suited for beginners
- legendiriz68 9y ago" A language that doesn't affect the way you think about programming, is not worth knowing." If this would be common practise nobody would learn golang.
- eliben 9y agoGolang certainly affected the way I think about programming, having learned it after ~15 years of programming experience. FWIW, I think most language can affect thinking - but the degree varies.
- davedx 9y agoI have to say after diving into ClojureScript I came away thinking differently about a number of things - state management, how to program functionally when you are more constrained than in more permissive languages. It was a real learning experience.
- serpix 9y agomy view is the opposite, ClojureScript is more permissive than Javascript :/
- hannofcart 9y agoThis ^ right here, is what gets lost in all the squabbling over functional purity and parenthesis hate. For a huge number of developers coming from the Javascript/web side of things, Clojurescript is poised so perfectly to usher them into thinking about composing your programs as pure functions, immutable data structures and organizing your state such that it is easy to reason about. Eventually, Clojure led me to Haskell, and even back to how Javascript ought to be written (i.e. fantasy-land specs). This has been the single most eye opening learning effort that I have ever had the joy of undertaking since I started programming.
- keymone 9y agoClojure is the language where LISP clicked for me. Can't recommend it enough, it's got all of it - immutable datastructures, convenient data literals, simple and composable concurrency primitives, very thin interface to host VM. Just put enough effort to get beyond that "omg parenthesis" barrier and it will be a delight. It's like that Half-life joke: there are two kinds of people, those that finished Half-life many times and those that never got off the train (which as somebody will probably point out, is a variation on another joke, but you get the idea). totally unaffiliated: https://www.braveclojure.com/clojure-for-the-brave-and-true/ https://www.braveclojure.com/clojure-for-the-brave-and-true/
- cle 9y agoI've learned to love the parentheses, because they embody what is so nice about lisps (and particularly Clojure)--inside the parentheses is a little nugget of functionality that generally stands on its own. No syntactic tricks, the only "trick" is the macro system, but it's so straightforward that I'm not sure I'd call it a "trick". The other immediate barrier is when Clojure barfs an ugly stack trace. I've heard that 1.9 will address that with core.spec, but I haven't explored it yet.
- agumonkey 9y agohmm sexy idea to have spec help for stacktrace. I expect something cute like elm error messages. About the parens, it's true it's one great thing, every construct has a value [1]. It's funny because You hear about object orientation where things are uncoupled and standalone yet the language isn't this way. Lisp has this, it's the incarnation of its own idea. But it looks silly if you're in it for the syntactic appeal. [1] Although I often wish for a helper thing when evaluating the body of, say a let to grab the bindings instead of saying "unknown var a in (inc a)". This is lisp in general
- DigitalJack 9y agostack traces still suck as far as I've seen on the 1.9 alpha branch. And while clojure spec is pretty neat, the barge-load of information it dumps on a spec failure is overwhelming. That said, the info it dumps is in the form of clojure data structures. In my own programs, I've added code to refine this output to something useable, but it's particular to my project and I don't think generally useful. There are other projects to aid in this fashion too. Expound is one that takes inspiration from Elm, and Inspectable is intended to help at the repl by launching a gui for exploring Specs and failures. I've tried both, but couldn't get inspectable to work in my environment, and expound isn't meant to handle the error I've been dealing with, so I can't speak to either.
- cderwin 9y agoIf "expanding your brain" is really what we want to optimize, why not learn Haskell? Or for that matter, why not learn something even more strongly typed, like Agda or Idris? Or even a theorem prover like Lean? Most of the reasons the author presents would either be expanded in one of those languages, or is immaterial to the goal of maximizing learning. After reading the article I have no more reason to consider learning Clojure over learning any of the languages above.
- yogthos 9y agoOne huge difference is the workflow you have in Clojure. REPL driven development is an experience unique to Lisps. When you're working with Clojure, any code can be run in the context of the live app straight from the editor as you write it. This is an amazing experience and very mind expanding in what a development process can look like. Also, anybody who wants to try FP style programming, but isn't interested in static typing is much better off with Clojure. Type systems in languages like Haskell and Idris add a lot of complexity and mental overhead that's not present in a dynamic language.
- drawnwren 9y agoIs there something about clj's repl that makes it any different from ghci's?
- yogthos 9y agoYes, you can reload any symbol in the CLJ REPL directly from the editor. You can also evaluate any function within the context of the running application without going through the main. The REPL is an integral part of the development process in Clojure. You can see this in action here around 15 minute mark https://www.youtube.com/watch?v=nItR5rwP4mY https://www.youtube.com/watch?v=nItR5rwP4mY
- dracodoc 9y agoR and RStudio are actually quite good in this aspect. - You can evaluate any part of editor in console with keyboard shortcut. The only difference between using console and editor is that your input is easily saved in editor. - The environment browser make inspecting variables, data structures much easier. Besides, in R you want to use vectorized functions for better performance, so you search for general functions and combine them, which actually promote good functional programming style instead of a big control block with many processes intertwined.
- vosper 9y agoHaving spent some time programming in Clojure, for the purpose of expanding my brain, I suspect a better Lisp to start with might be one of the classics - Racket, Common Lisp, etc... One of the reasons I gave up on Clojure was the lack of documentation of libraries, the bad debugging experience (those stack traces!) and the fact that there's no avoiding the JVM. They're all distractions to the learning (that was 2 years ago, I'd be happy to hear that things have changed). I think Clojure is a great language, but if you just want to expand your mind via a Lisp then I think you'll get more for your time with another implementation.
- jiyinyiyong 9y agoAgreed. Debugging Clojure(Script) is a pain. Although I still need to use ClojureScript.
- zimablue 9y agoI had a similar experience, trying to learn clj/cljs before I know java, javascript or the web stack. I am a classic arrogant developer (I'll learn it all at once as I go) but in retrospect it was honestly a mistake. If I'd learned basic web servers+node+react/redux then Clojure I'd know more of both than doing it in reverse.
- hellofunk 9y agoCommon Lisp is much more complex and challenging. Also, it is not really a functional language in the way Clojure is; it offers mutation, OO and imperative programming as its normal paradigms.
- peatmoss 9y agoI can occasionally get away with writing Clojure for "real" work, but for hobbying (and inshallah for real work someday) my goto is Racket. I feel like Racket is something of an optimum among the lisps in terms of brain expanding, modernity, tooling, libraries, docs, and community.
- aaron-lebo 9y ago
- lngnmn 9y agoWhy not Common Lisp or Scheme?
- cgore 9y agoI did Common Lisp back in college for several years, it's a great language. But good luck getting a job with it. Clojure on the other hand, I've been paying my bills with that for the last few years. The main difference is a much larger community, and therefore lots more libraries for real-world stuff, and sitting on the JVM you have a lot of options integrating with existing corporate stuff.
- agentultra 9y agoThere's a Common Lisp implementation that sits on the JVM. It's called ABCL. It provides a Java API for loading and calling Lisp code as well as a Lisp API for calling Java code (although it is quite a bit more verbose than that provided in Clojure... nothing a few macros couldn't solve if it became a nuisance). The community is what does it. I tried for years to get commercial work in Common Lisp. It never happened.
- flavio81 9y agoI wonder the same. And the author writes: >"and Clojure is the first Lisp I'd consider using in production". I can't really understand the logic in this. If anything, CL has more going for it for production usage, like ANSI standarization and many high-performance compilers.
- yogthos 9y agoClojure has the advantage of targeting the JVM and Js runtimes. These are two most popular runtimes for writing web apps currently. Clojure can also be easily integrated into existing projects on these platforms.
- flavio81 9y agoYour Common Lisp code can also target the JVM runtime by compiling using the ABCL implementation (free, mature). It is ANSI compliant, so your code will work straight away with no change. ABCL also allows easy calling of Java libraries. Furthermore, not only JVM: other CL compilers let you target the LLVM. And of course you also have native compilers like SBCL which produce blazingly fast code.
- hellofunk 9y ago> core.spec makes it more formal and verifiable. This is very useful when working with data, and is another example of where Clojure's pragmatism shines; the language is dynamic in its core, but when you need static typing - it's there, optionally Um no. Spec is not static typing, it does runtime checks. And core.typed is currently being rewritten and is not compatible with current version of Clojure.
- chpill 9y agoI have been working with Clojure(script) full-time for the past 4 months (coming from javascript). I highly recommend it. Programming is fun again.
- escherize 9y agoNothing I've used has the combination of ease of use and interactivity. It's pretty difficult to explain, but one can send both top level forms, or smaller pieces of code to the repl and get results without leaving the code one is working on. https://s3.us-east-2.amazonaws.com/photoblobs/screencast_2017-08-04_09-03-37.mp4 https://s3.us-east-2.amazonaws.com/photoblobs/screencast_201...
- deleted 9y ago[deleted]
- deleted 9y ago[deleted]
- moomin 9y agoClojure will affect the way you think about programming. It's led a number of people I know to start taking Haskell seriously after their Clojure phase.
- lgas 9y agoThis seems somewhat surprising to me since they are, in some sense, at opposite ends of the functional programming spectrum... but it's the path I took.
- moomin 9y agoI think it's a cultural thing. There's something similar going on with Python and go. Seems like a lot of people start with "getting types to go away makes a lot of powerful things easier". But eventually you a) get sick of typos causing runtime errors b) start to realise there are even more powerful things you can do with a non-broken type system.
- niix 9y agoI was fortunate enough to be given the opportunity to learn Clojure on the job. A majority of my work is on the web side (JavaScript, et al.), so learning Clojure was a fun and interesting challenge. After the initial hurdle of getting used to a Lisp I found the language very liberating. I definitely approach problems very differently than I did prior to learning Clojure, even when flipping back to JavaScript land. I find my approach is vastly different that it was before. The best way to describe my way of thinking is that I'm very "data first" now.
- deleted 9y ago[deleted]
- shadowmint 9y agoI don't like working with clojure. Its basically modern perl. I've worked with both professionally, and the outstanding point with both has been: - programmers try to be clever in their code, write one giant file full of complicated specialized 'beautiful' code, forget everything they know about breaking big tasks into simple small ones. - code is a nightmare to maintain for non-author - non-authors working on code results in adhoc mess of styles Play with, sure. Learn a few things and watch the videos, absolutely. Rich is a really thoughtful talker. I actually quite enjoyed clojure before I had to collaborate on a code base. ...but goodness me. I cannot strongly enough recommend against using it professionally.
- davedx 9y ago> - programmers try to be clever in their code, write one giant file full of complicated specialized 'beautiful' code, forget everything they know about breaking big tasks into simple small ones. What on earth does this have to do with clojure? Programmers will do this in any language, there's nothing special about clojure here. I personally don't find LISP languages to be the most readable, but I'm fairly sure it's subjective. If you learned LISP and then went to Java, your brain would probably struggle to process all the verbosity...
- shadowmint 9y agoRubbish. I've worked with a dozen languages, and its unquestionable that certain ones attact a high ratio of terse complicated code. Clojure is specifically renouned (and celebrated) for its low LOC counts; people go as far as saying (literally on /r/clojure) given a choice of library, pick the one with a lower LOC. That's not because people write simple pointless libs like lpad; its because the community actively encourages terse complicated code.
- yogthos 9y agoThis is demonstrably false.
- ambulancechaser 9y ago
- swlkr 9y agoClojure also affected the way I think about programming in a very positive way. There are downsides to it - stack traces - jvm - lein is pretty slow but the upsides - immutable data structures - lisp/macros - repl (you can send code from your editor to the repl) - community - great open source web app libraries (for me, anyway) outweigh the downsides. I encourage everyone here to try clojure at some point, it might just become your favorite language.
- cnlwsu 9y agoFor people familiar with java, the jvm is an upside. Being able to use libraries (especially client ones) from your project can be very useful. The amazing interop support is very nice if your pragmatic over purist and don't plan on rewriting a ton of things.
- swlkr 9y agoThis is true, if you're a java/jvm person, this is a huge upside, even if you aren't, once you see just how much code has been written in java, you'll probably come to appreciate the pragmatism. When I learned clojure two years ago, I didn't have any experience with java or the jvm, so I had to sort of learn where the boundary was. After that initial hurdle however, I now use java interop quite a bit.
- hellofunk 9y agoBy far the most incredible thing for me was to see how far a few characters of code can go. Clojure is a very tight language where you can accomplish a lot in just one line of code. You end up suddenly having all this new, extra time to just think about your problem instead of coding it.
- yogthos 9y agoAnother interesting side-effect of tight code, is that you become a lot less attached to it. When I worked in Java, it would often take 100s of lines of code to solve a simple problem, and once I wrote that code I'd be very hesitant to throw away or refactor it. With Clojure, it often takes 10 lines or less to solve problems that take 100s of lines of Java. This encourages a lot more experimentation and refactoring in my experience. Also, since you're always working in the REPL, you can always run the code after you change it and see that it's doing what you want immediately.
- macintux 9y agoThe functional nature helps with the lack of fear of refactoring. Your Java code may have side effects reaching across the code base.
- iterati 9y agoI was lucky enough to land a Clojure job (stitchdata.com, we're hiring!) before having to learn Clojure, because I had the benefit of experienced mentors helping me get to grips with lisps (which were alien to me) and a development workflow that leaned heavily on the REPL (emacs + cider). Clojure has changed the way I think about many programming concepts and has been a joy to learn. It has it's warts but the core is very well built and I find the documentation to be quite good once you understand the basics.
- bryanrasmussen 9y agoThe problem is that I want to expand my brain, but I also want to get things done and I have a family. I think this is one of those you can choose 2 situations.
- jasonkostempski 9y agoUse breaks and sleep less once in a while. It's just what you've got to do if you want to learn new things outside of your current obligations.
- awkwarddaturtle 9y agoThat's true of any language. Even within the same language paradigm. If you know C#/Java then learn C++ or vice versa and it'll affect the way you think about programming. Or move on to different paradigms... Go outside of the statically typed OO world and try out the dynamically typed OO languages like ruby or python. Even better, learn a weakly typed procedural language like C ( lingua franca for CS ). Or choose an architecture and learn some assembly. Now that will affect the way you think about programming. Move out of onto a different domain altogether and try one of the flavors of a declarative language like SQL. Learning a bit here and there of many different languages and paradigms will affect the way you think. Clojure isn't special. You can even just stay within a framework and try to get a deep understanding of .Net language/IL/Framework Libraries/Runtime stack. Then you get into the debate of breadth vs depth. Should you learn one language/framework/paradigm exceptionally well or should you learn a bit about a lot of a lot languages/paradigms?
- miguelrochefort 9y agoWant to affect the way you think about programming? Learn Prolog.
- cnlwsu 9y agowhy not both
- flavio81 9y ago+1 ... and then implement Prolog in Lisp so you can write Prolog on your Lisp code as well (this has been done many times)
- taktoa 9y agoProlog is a programming language for turning polynomial-time algorithms into exponential ones.
- zmonx 9y agoAnd, true to form, it often works in the other direction too! Especially with CLP(FD) and other Prolog constraints.
- bachmeier 9y agoI would love to use Clojure (it's probably the only language I would consider moving to right now) but the JVM just doesn't work for me. Clojure-native that offered all of Clojure and was realistic - there was one that indirectly used Gambit Scheme at one time, and an incomplete Python version - would be awesome. Clojure that requires you to use the current Java approaches to interfacing with C is not of interest.
- DigitalJack 9y agoI've felt that way about clojure native, but what makes a language is the ecosystem, and the JVM brings a fantastic ecosystem. There really is no way to offer "all of clojure" as native because the ecosystem is part of what "all of clojure" offers. I've long thought about ways of doing a "native" clojure, and have eventually come to the conclusion that it doesn't offer anything compelling. If you want fast start up time and scripting, you can do that with node and clojurescript. Or Lumo or whatever else there is in that area. Once running, the JVM is pretty performant in a lot of cases... Where it struggles are where all garbage collected languages struggle. If that's the pain point, you could probably bootstrap a scheme from Gambit or Chicken that did manual memory management...I struggle to imagine what that would look like in the end though. Lisp flavored C maybe. People smarter than me have said that the Clojurescript compiler is an excellent starting point for making a compiler that emits other languages. It's over my head, but maybe it would be a worthwhile project to emit golang or something. I believe some of the clojure-schemes that floated around briefly bootstrapped from clojurescript compiler to emit Gambit Scheme... Without the libraries/ecosystem I don't think it would be worth it.
- bachmeier 9y ago> the JVM brings a fantastic ecosystem Unfortunately it's (intentionally) horrible for interfacing with C libraries. > it doesn't offer anything compelling Unless you need to interact with native libraries. There's currently a lot of excitement about Scala Native and Kotlin Native. Those projects aren't being done just for the heck of it.
- 9y ago
- davidreiss 9y agoThat's true of any language. Even within the same language paradigm. If you know C#/Java then learn C++ or vice versa and it'll affect the way you think about programming. Go outside of the statically typed OO world and try out the dynamically typed OO languages like ruby or python. Even better, learn a weakly typed procedural language like C ( lingua franca for CS ). Or choose an architecture and learn some assembly. Now that will affect the way you think about programming. Move out of onto a different domain altogether and try one of the flavors of a declarative language like SQL. Learning a bit here and there of many different languages and paradigms will affect the way you think. Clojure isn't special. You can even just stay within a framework and try to get a deep understanding of .Net language/IL/Framework Libraries/Runtime stack. Then you get into the debate of breadth vs depth. Should you learn one language/framework/paradigm exceptionally well or should you learn a bit about a lot of a lot languages/paradigms?
- jasonkostempski 9y agoThat is true. Heck, eating a particular meal might affect the way you think about programming. But the article title, and the original HN title, is "Clojure - the perfect language to expand your brain?" So it's asking if Clojure is better at it than other languages/paradigms.
- davidreiss 9y ago> So it's asking if Clojure is better at it than other languages/paradigms. My argument was that there are such a wide variety of languages/frameworks/paradigms that it makes no sense to make such a claim. Someone from a functional background ( lets say you know scheme or ML ) would get more from learning an OO language than from learning clojure. He'd learn more from learning assembly and seeing how data moves in and out of registers than from learning clojure. Programming is such a wide topic. We get this posts all the time. Go will expand your mind more than anything or ruby will or F# or any other flavor of the day or even python. It all depends on who you are and what you know. In other words "Clojure - the perfect language to expand your brain?" is a silly assertion. There is no "perfect language" because everyone's brains are different because we all come with different backgrounds and expertise. But that's just my opinion.
- delegate 9y agoI agree with the article, but would also like to mention that it has a very steep learning curve. 1.5 months after my first line of Swift I had my app in the app store (granted I was proficient in Objective-C). 2 years since I've started learning Clojure and a couple of months since I'm working professionally with it and I'm still quite shaky. Luckily, it's not difficult to begin - you can start hacking small programs in a couple of days, but when it comes to building large applications, that's when it becomes a high-level art form (just one of the many possible metaphors :) ). Quite similar to C++ in this respect - easy to pick up, hard to master. It humbled me and made me cry many times. But as with everything, if you don't give up, you level-up. As far as the experience goes, it gives you this 'overview' experience of programming - you can mimic almost any feature from other languages and you have access to all the libs for the JVM (including C/C++ libs through JNI) plus all the javascript libs. So in terms of libraries you can use, I dare say that Clojure(script) is the language which can access the most libs out there. So yeah, definitely a powerful language and a powerful tool which you can go very deep into, albeit a bit tough to learn.
- droidist2 9y agoIt's a bit of a change from most mainstream languages, but still way easier than Haskell though.
- lispm 9y ago> Clojure is a dynamic language. Dynamically typed. As a dynamic language Clojure is less capable than many other Lisp implementations/languages. See for example 'late binding'. In Clojure you either need to define a function before its use or need declare it. Not that 'dynamic'. In a typical Lisp dialect the order of definitions makes much less a difference, since functions can be called late-bound. For an interpreter-based implementation, it makes no difference at all. > It promotes combinations of built-in data structures (lists, maps, vectors) over objects An aspect I don't like. This makes debugging of larger systems more difficult, since maps are maps. Whereas objects have a type tag built in, have a list of allowed fields, etc. etc. They simply have more more explicit and standardized structure to them. > Some built-in features like reducers and transducers rely heavily on composing higher order functions for transforming other functions. Which makes code complex, since transducers are a mildly complex mechanism. > It encourages REPL-based development In relatively weak form. Basic features of Lisp need to be added to do simple tasks: like 'instrumenting' code to debug it, since it lacks an interpreter or more capable compiler support. REPLs with actual interactive error handling are not standard. Interactive Lisp compilers like the one from SBCL give much more information and warnings. Thus the Lisp development features are at best only medium-level. > Historically, Lisp programmers weren't the biggest proponents of OOP Funky, people from the Lisp community helped to shape OOP and explored much of it. From guys like Hewitt who developed the actors paradigm in the early 70s, Minsky who developed the frame theory mid 70s and inspired a whole range of OO programming in Lisp, to Howard Cannon who developed Flavors in 1979 with flexible mixins and multiple inheritance used to implement the object-oriented operating system parts of the MIT Lisp Machine, to Lieberman who developed OOP with prototypes mid 80s, to Kiczales who worked a decade on OO in Lisp (LOOPS, CLOS, Meta-object Programming, Object-oriented Protocols, Meta-level architectures, early Aspect oriented programming, ...). Actually objects in the early Lisp were simply symbols with their property lists. These property lists could hold both normal attributes and also functions.
- weavejester 9y ago> An aspect I don't like. This makes debugging of larger systems more difficult, since maps are maps. Whereas objects have a type tag built in, have a list of allowed fields, etc. etc. They simply have more more explicit and standardized structure to them. You can create explicit and standardised structures for maps in Clojure, or indeed any other data structure: (s/def :foo.student/name string?) (s/def :foo.student/score nat-int?) (s/def :foo/student (s/keys :req [:foo.student/name :foo.student/score])) (def example-student #:foo.student{:name "Alice", :score 30}) However, Clojure takes a somewhat divergent philosophy, as it encourages writing schema for individual fields, rather than a schema for a grouping of fields (such as an object). For example: {:foo.person/name "Alice" :foo.student/id "xyz123456"} The namespaces of each keyword are different, but they're grouped in the same map as they happen to refer to the same entity. So rather than operating on a fixed type like `Student`, a function would request that it requires a data structure that has a person's name and a student ID: (s/fdef enrol :args (s/cat :student (s/keys :req [:foo.person/name :foo.student/id]))) We're still validating (albeit dynamically), but we can be more flexible in what data we ask for. This ties in with Clojure's idea of simplicity; a function shouldn't know about data it doesn't intend to use.
- didibus 9y agoI started learning Clojure two years ago, and it has expanded my brain in many ways. I love Clojure for the pure joy it gives me on a daily basis. In those two years, it thought me about: - Interactive programming - Persistent data structures - Immutability - Code that writes code - Functional programming - Extendable polymorphism - Lazy evaluation - Eager evaluation - Parallel computing - Dynamic variable extent - Recursion - Concurrent programming - Declarative programming - Aspect oriented programming - Logic programming - Code as data - Software transactional memory - Generative testing - Contracts guards - Optional type systems - Conditional restarts - Monads - Variant types - Collection abstractions - Array programming - Map Reduce - List comprehensions - Reactive programming - S-expressions - Destructuring - Pattern Matching - Prefix operators - Closures - Data literals - And more...
- shadowmint 9y agoOur experiences with clojure are clearly different. There have been plenty of people who have built successful businesses with perl too. /shrug I'm still going to recommend people not use either language, because I've personally encountered the downsides of 'when things go wrong'; and it's been significantly worse than in other languages. > Are we doing opinion threads now? Okay. I can do one too! That's a bit of a flip off isn't it? What I have to say is based on my professional experience. Don't like it? Tough. Luck. You had a different experience? fair enough. You want to call it an opinion thread? Well, you know what they say. Opinions are like assholes, everyone has one...
- KirinDave 9y ago> I'm still going to recommend people not use either language, because I've personally encountered the downsides of 'when things go wrong'; and it's been significantly worse than in other languages. I... Didn't ask. I appreciate your post as a jumping off point for mine, but I honestly I think what you're going to do is not relevant to me. Thanks for the heads up though. > That's a bit of a flip off isn't it? I'm not sure what "flip off" means in your dialect. In mine... No? You have an opinion and I'm clearly stating the following is mine. I'm sorry if you found this combative. I took pains to face the content away from your points to focus on what I like rather than what you hate. I could contest your post if that's what you'd like me to do, but it seems like you're fairly defensive on this subject. So maybe that's inappropriate. > You want to call it an opinion thread? Well, you know what they say. Opinions are like assholes, everyone has one... Oh yeah, I know this one. Opinions are like assholes, everyone has one, but a person named shadowmint on Hacker News seems very keen to suggest theirs is ground truth with vaguely sourced points. I had never really understood how that classic anecdote had relevance in the modern world, but here we are. Wow.
- shadowmint 9y ago> I... Didn't ask. If you have an opinion that is unrelated to mine, don't reply to my thread then. You have an opinion? Great job. Good work. Calling my comments an 'opinion piece' is actively combative. If you dont want to do that, then how about you just post your opinion in its own thread? Its easy and saves us having this conversation, if you're not interested in a discussion. > but a person named shadowmint on Hacker News seems very keen to suggest theirs is ground truth with vaguely sourced points. Fuck off. Really. If you don't want to talk about it, then don't reply. I've in no way suggested your experience with clojure is anything less than you've said it has been, and all I've posted is my experience with it. You're being a jerk.
- mercer 9y agoFor those of you who have experience with both Clojure and Elixir: what would be reasons to choose Clojure over Elixir, if any? And vice versa?