Live data from Hacker News

Why Clojure?

blog.cleancoder.com

141–150 of 202 posts

Re: Why Clojure?

#141
post #95

Earlier quoted context omitted.

Not the grandparent, but I realized the other day that I'm at nine years of clojure, so... What's made clojure so great, imo, is its unicorn status as a principled-yet-practical language. That "principled" part is not worthless---it means that a lot of great minds are drawn to it. Before react took over the world, clojure folks were already taking steps in that direction. A lot of other things. The "sequence" as a co…

What is GUI programming like in Clojure? What libraries exist, and what paradigms are used? E.g. is it more like React or is it more like Gtk/Qt?

Seesaw/swing are the old stable solution. The latest library is cljfx built on JavaFX. The developer is very responsive and open about it's development

Check out the examples/mini-tutorial: https://github.com/cljfx/cljfx

It's all React-like. You have a state atom and a GUI map data structure (which I think is equivalent to your DOM in React..) and then you hook up events that update the state and blah blah. It's all very clean and easy to read/use. The underlying JavaFX is also great for an OO GUI library so it's not gross to dive into if you need it

Re: Why Clojure?

#142

Earlier quoted context omitted.

You don't actually need to know anything about Java to be productive in Clojure. At least that was my own experience.

I've been told that before and respect your experience even if it is very different than mine. Let's talk about writing code in Python. You write a script and either run it through your IDE or via the command line via Python pythonscript.py. With D, I write some code and feed it through the compiler like dmd scriptname.d. With Clojure in addition to all the cruft I have to learn (Emacs, leinegen...etc), I still have…

You can run Clojure without Leiningen and you definitely do not need to learn emacs. I use vim, but Cursive (IntelliJ plugin) is IMHO the most beginner friendly option available (other good options include Nightlight, Atom with clojure olugin, VS Code with plugin). You can run Clojure without learning Leiningen with many of these too.

Re: Why Clojure?

#143
post #38

My team owns a Clojure app, amongst a lot of other apps - my understanding is the current DRI (who inherited this app once the original one left for another org) doesn't like working in it though, and that has been the experience of other developers who have been recruited to the project over the past two years. Most developers I work with on a day to day basis don't have any interest in learning Clojure, and would r…

> The primary problem is it doesn't try to abstract away the DOM

Clojurescript has heavily bought into React. No cljs programmer I know deals with the DOM, but rather uses a React-based library to do it. Personally, I use re-frame and reagent and haven’t needed to interact with the DOM myself in years. I find working in cljs a LOT more productive and pleasant than working in Javascript (which I also use a lot, although if given the chouce I’d use cljs instead).

Re: Why Clojure?

#144
post #128

Earlier quoted context omitted.

This is true literally for every language out there. My team maintains a Java application from over a decade ago. It's an utterly incomprehensible mess that nobody understands, and it's incredibly difficult to make any changes to the project. It's not the job of the language, but rather that of the developer to write clear and readable code. This problem is addressed by using good design practices, code reviews, test…

Oh, we also own plenty of those in Java. That's the job- carefully lay the legacy to rest as you replace it with something better. But at least the Java is overly verbose. It takes a while to read all that code. With the clojure stuff, I'm staring at the same line for just as long and getting no where.

Clojure is not a particularly cryptic or difficult language so maybe a refresher in the language and standard library might help.

Re: Why Clojure?

#145
post #5

It just breaks my heart to see Uncle Bob seduced by a Java-family language right when C++ is getting increasingly fun. He suffered through the bad old days when C++ was only fast and powerful, and is now missing out on the good new days. I guess he's happy. At least he isn't touting Haskell. Bon Voyage, Bob! But somebody needs to break it to him that Lisp is not a functional language. Or, if it is, so is C++.

Clojure isn’t “Java family” any more than anything running on top if a C runtime is C family. Clojure is also a lot more if a functional programming language than Common Lisp is.

I also disagree with you on C++. Cc+11 was a fantastic improvement, C++14 added some missing stuff — at this point I was sold and eagerly awaiting C++17 — but when 17 arrivd and when I saw what 20 adds... it has become so complex that I don’t understand it at all anymore. I used to scoff at the people who said C++ was too complex, but after ~18 years of using the language its now reached a point where I am no longer comfortable using it. I see code that uses C++17 and recently 20 and I have no idea what its doing anymore. I am no longer confident that I can write safe, non bug-ridden code in C++.

Re: Why Clojure?

#146
post #93

> 1. Economy of expression Funny, this list is the same one I use as to why I'm so annoyed with Clojure right now. I inherited a mission-critical Clojure ML library my team uses for it's primary business goals. It was written 4 years ago by a research scientist- who quit 3 years ago. We know what it's supposed to do. We know that it seems to do the job well. We just can't understand the code well enough to be certain…

> ML library (...) It was written 4 years ago by a research scientist (...) Do you believe the language is the issue, been written by someone not trained on software engineering practices? Would you find untested (I'm betting this code you inherited lacks tests, from experience working w/ ML research code artifacts) verbose Algol-family code any easier to understand?

Yes, agreed. That being said, there are languages (without naming names) that lend themselves to readability by others and those that don't.

Re: Why Clojure?

#147
post #35
post #3

Clojure is by far the best programming language I've ever used. Rich Hickey's Sermons On The Mount changed the game of programming once and for all. With Clojure you could finally have your Lisp cake and eat it. Witness the sheer chutzpah of the guy when he basically told Ruby devs they were doing it wrong at Rails Conf in 2012 ( https://www.youtube.com/watch?v=rI8tNMsozo0 ).

> by far the best programming language I've ever used Would love to hear why? What is that make Clojure such a good experience for you?

Dynamic and functional. Lazy evaluation. Real immutable data structures. Core.async. A modern lisp not constrained by the exclusive use of parens, ie. [] for vectors and {} for sets & maps as with JS, Python and Ruby. Real REPL-driven development. Macros. Spacemacs with CIDER. Polymorphism which beats OOP at its own game. Massive Java ecosystem at your fingertips plus 25000 pure Clojure libraries and last, but by no means least - a rock 'n roll BDFL with a mullet.

Re: Why Clojure?

#148
post #35

Earlier quoted context omitted.

> by far the best programming language I've ever used Would love to hear why? What is that make Clojure such a good experience for you?

Not the grandparent, but I realized the other day that I'm at nine years of clojure, so... What's made clojure so great, imo, is its unicorn status as a principled-yet-practical language. That "principled" part is not worthless---it means that a lot of great minds are drawn to it. Before react took over the world, clojure folks were already taking steps in that direction. A lot of other things. The "sequence" as a co…

I wish the last bit was true. Clojure jobs are very thin on the ground even here in startup London.

Re: Why Clojure?

#149
"Economy of Expression. [..] It requires fewer lines. It require fewer characters. It require fewer hours. It requires fewer mental gymnastics. So, here, for your entertainment, is the program that prints the first 25 squares of integers."

    (println (take 25 (map #(* % %) (range))))
And in APL[1], iota 25 is the first 25 integers, and feeding the same list into both sides of multiply squares the list, then turning it from a row to a column is tabling it. "Table the multiply-commute of the first 25 integers":

    ⍪×⍨⍳25
It's fewer lines, fewer characters, fewer hours, less syntax, less grammar, fewer symbols, fewer functions, less nesting, fewer mental gymnastics. Yet .. worse? Because those things you say both lead you towards codegolf, and implicitly have "fewer mental gymnastics" mean "I'm familiar with it already".

[1] https://tryapl.org/?a=%u236A%D7%u2368%u237325&run

Re: Why Clojure?

#150
post #3

Clojure is by far the best programming language I've ever used. Rich Hickey's Sermons On The Mount changed the game of programming once and for all. With Clojure you could finally have your Lisp cake and eat it. Witness the sheer chutzpah of the guy when he basically told Ruby devs they were doing it wrong at Rails Conf in 2012 ( https://www.youtube.com/watch?v=rI8tNMsozo0 ).

Ever play with Erlang or Elixir? If yes, I am curious what your thoughts are on them.

Yes, Elixir would be my second choice but although it has Lisp influences it doesn't capture the real magic of Lisp for me. Code as data belongs exclusively to real Lisps. Elixir also lacks vectors of its own and tends to be too niche compared with Clojure.
Post reply on HN