Live data from Hacker News

Clojure will affect the way you think about programming

eli.thegreenplace.net

121–130 of 226 posts

Re: Clojure will affect the way you think about programming

#121

I 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 r…

Are we doing opinion threads now? Okay. I can do one too!

I do like working with clojure. It's my favorite dynamically typed programming language by an easy margin.

It's basically everything that was a good idea in Python and Ruby brought under the unifying role of a Lisp syntax, with a good Java FFI. This makes it slightly harder to learn (it's very difficult to learn Clojure if you don't at least know Java).

It has a very clean syntax for the most part. Parenthesis handling does need some automation (basically everyone copied paredit) but has the nice property that refactoring is a breeze and extremely predictable.

Except for rogue agents like me and a few others, very few programmers go crazy with defmacro, which makes Clojure often a lot more orderly and understandable than lots of Common Lisp code.

I've run a shop with 6 clojure developers collaborating with engineers in both mobile and web space, and in many places Clojure was such a delight that cljs began to creep into the web frontends. In many cases the mobile devs contributed API endpoint handlers to the codebase and they said in general it was easy to work with (although folks sometimes had problems with more complex map types; often because of leftover code from the Bad Old Days when :symbol-a and :symbol_a both got introduced into our codebase because of bugs in AWS bindings choking on -'s).

Clojure, like many dynamic languages, is ultimately limited by its lack of a type system. At some point systems become challenging to refactor. To combat this, a lot of discipline about testing and builds needs to happen.

I built a business around Clojure, sold it to a bank, and made lots of money and friends along the way (and just yesterday the bank announced they have decided to kill it because they don't like it, but that's got little to do with clojure and everything to do with ). We did stuff that VCs flat out claimed was impossible, to my face.

I'm much more interested in other languages now, but that's not because I think Clojure is bad. It's because I think that my development as a software engineer requires I put Clojure down for a few years and work with other concepts.

Re: Clojure will affect the way you think about programming

#122
post #100
post #78

Earlier quoted context omitted.

Do you know of a good resource for reading about their data-structures, especially anything Haskell doesn't have?

Hash Array Mapped Tries are what underly the default maps in Clojure: http://lampwww.epfl.ch/papers/idealhashtrees.pdf They are pretty amazing. Of course there are implementations in Haskell now, but the reason they are especially cool in Clojure is how well they integrate with the language and its other features.

I think Bitmapped Vector Trie [1] might be some novelty introduced by Clojure.

[1] https://stackoverflow.com/questions/8844707/how-is-a-bitmapp...

Re: Clojure will affect the way you think about programming

#123

That'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…

That 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.

> 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.

Re: Clojure will affect the way you think about programming

#124
post #20

Clojure 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…

I keep hearing this sentiment, moreso than I've ever seen for any other language. Once you "get into" Clojure, you're both A.) Extremely productive with it, and B.) in love with Clojure.

How does it hold up for those of us that really love static typing and compilers?

Re: Clojure will affect the way you think about programming

#125
post #111
post #71

Clojure 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 j…

For 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.

This 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.

Re: Clojure will affect the way you think about programming

#126
> 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.

Re: Clojure will affect the way you think about programming

#127

I'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?

Scheme is better. It's more powerful and far smaller.

Re: Clojure will affect the way you think about programming

#128

I'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?

Scheme is better. It's more powerful and far smaller.

Re: Clojure will affect the way you think about programming

#129

Earlier quoted context omitted.

I'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 t…

> 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.

A lot of projects are done for the heck of it. Nothing wrong with that.

Native libraries is a good reason. Particularly GUI libraries.

I imagine Swift would be a decent target for a lisp, for app development.

GUI is a major missing area in clojure. There are some good efforts there, Seesaw targeting Swing, and fn-fx targeting JavaFX.

Re: Clojure will affect the way you think about programming

#130
post #78

Earlier quoted context omitted.

There are many things to love in Clojure, like core.async, the lispyness, etc. But for me, their biggest breakthrough is with no doubt the data-structures. Clojure default of immutable hash maps and vectors was really bold. They had to innovate by giving a twist to Bagwell's great research on data-structures, and they managed to build what in my opinion are the first set of general data-structures suitable of represe…

Do you know of a good resource for reading about their data-structures, especially anything Haskell doesn't have?

Here's a blog post[0] from the guy who implemented Lean Hash-Array Mapped Trie (HAMT) maps for clojurescript. It's really cool stuff!

[0] https://bendyworks.com/blog/leveling-clojures-hash-maps

Post reply on HN