145 points · by edem · 12y ago · 81 comments
I wouldn't be surprised if Clojure has more "industry" adoption than Scala at this point.
Give me Clojure semantics (anti-OO, maps, vectors, and seqs) with some optional typing and a Python syntax then I'm there *
* that's just my preference, no need to convince me of anything other.
Scheme's SRFI 49 (2003-2005, Final): "Indentation sensitive syntax": http://srfi.schemers.org/srfi-49/srfi-49.html
Lispin (2008): So utterly dead, we have to resort to the Internet Archive: http://wayback.archive.org/web/20080517144846id_/http://www....
cl-2dsyntax: http://www.cliki.net/cl-2dsyntax (Annoying exclamation marks in this one, oops).
CGOL (1973!): http://en.wikipedia.org/wiki/CGOL
The last one shows you just how long people have been unsuccessfully trying to promote Algol-like syntaxes for Lisp.
That would be F#.
Both languages are very similar in way that they support lists, arrays and maps as first class citizens as fundamental types and provide expressive algorithms to operate over them 'out of the box' with more or less uniform syntax.
To me, as a novice, the main apparent practical difference between the two languages are the domains for which there is strong support and which have discoverable solutions. I.e. the platform and the community.
If anybody on Arch Linux wants to give a Hy a try, I put together a PKGBUILD: python-hy.
I'm experimenting on this with Hype. It's barebones and does some whacky-don't-look-at-it macro "magic", but it works! Also trying to mimic core.typed's way of annotation.
Note: Just using python functions annotations with a typeannotation library to provide some runtime type checking. It's rather rad if i can say so my self.
https://github.com/Foxboron/Hype https://github.com/ceronman/typeannotations
Parenthesis are always offputting to me, even though I like a fair amount of clojure concepts. I often feel like functional programming has made a cottage industry around putting obfuscated names around relatively simple ideas (see transducers for example)
I'm not directly in the dev space, but it appears as though the choice of languages that people use has far more to do with what Builder Tools will support than what people actually want to use. Teams only use Scala or Clojure if they are willing to build it using their convoluted Ant wrapper that doesn't make any sense.
Combine that with Scala's bewildering type system and I can see why companies move to Java or Clojure.
I would be very surprised if that was the case, based on what I've seen.
Amazon is building a competitor to Bloomberg?
coming soon...storm-as-a-service (built on clojure)Implemented a scheme in my undergraduate days (in C), had a small love affair with LISP in general (but none with girls ... probably related).
I'll be opinionated here:
It's not readable. It really isn't. You have to be in the thick of it to see the trees. Idiomatic doesn't cut it.
Operator heavy Haskell is more readable. Most of the modern functional languages read closer to the spoken word.
I'd rather be presented with a legacy OO code base, than an LISP one if the LOC was anything significant.
I hope I don't come across as disgruntled, I am but a mere man, and I know my limits.
And still have fond memories of bedding LISP.
Hang on. Your opinion is that Clojure isn't readable because you didn't find other Lisps readable when you were an undergraduate? But you haven't actually tried Clojure yourself?
I have tried Clojure, and my opinion is that it's easily the most readable programming language I've found.
Clojure has very strong opinions about complexity, which in Clojure parlance is a measurement of interconnectedness between components. The language is built around the idea of reducing complexity, about making things isolated and independent. Idiomatic Clojure code therefore tends to have a very flat structure consisting of isolated functions and data structures. It has a very high degree of code reuse, because it explicitly rejects encapsulation.
Clojure's syntax may be unusual, and individual forms are more information dense than many languages, however the structure of Clojure code is often much easier to understand, and for any non-trivial piece of code, that's the hardest part of comprehension.
When I come across a new Clojure library, I'll often find myself reading a bit of the docs, then heading into the source code to get an idea of how it operates. I rarely do this with an object orientated language, as OOP code tends to be deeper, more interconnected, and because of encapsulation, have more methods to understand. Java in particular is terrible for this.
Maybe Clojure feels odd for a few hours when coming from C-like syntax, but it becomes so obvious later on. I remember I felt terrified by the parens because I had not written anything serious in it.
I'd say the most natural pathways for Java programmers upgrading their language skills are:
* from Java, to Groovy, to Clojure
* from Java, to Groovy, to Scala
* from Java, direct to Clojure
* from Java, direct to Scala
Once someone reaches Clojure and Scala, they seem unwilling to give up what they've gained (the simplicity and macros of Clojure, or the higher-order typing of Scala) to switch to something else, even when that something offers more.
Syntax? Not seeing any syntax here.
Also LISP (I assume you are talking about Scheme or Common Lisp and not the 60s langauge) is not the same as Clojure. It does share some syntax and some ideas but its also very diffrent in many ways.
You might prefer your legacy java in the simple case, buts lets talk again when that java code has to do concurrency or other complex problems.
> Most of the modern functional languages read closer to the spoken word.
Its actually a absolut non-goal of clojure to 'read like the spoken word'. Its a goal of clojure to write code in a simple way, simple meaning a speration of concerns were each part is easy to reason about.
For single-instance applications, sure. But for scalable systems, 90% of your concurrency is handled by whatever message broker you're using anyway. Tasks, Async processing, Blokcing Queues etc etc - they're all handled by your JMS provider.
However often you find that its not enougth for you and then you will have to write some costume code yourself. You might think one message passing system is enougth but then its more and now you have to manage message from three subsystems in your application.
Ill use a langauge that makes things easy when things are easy and not very hard if they are hard.
I don't feel that there's anything particularly magical with the paren being on the left hand side of the verb that automatically makes it less readable than when it is on the right hand side of the verb.
Especially that alternating pairs business.
Having to know what is a macro and what is not affects understanding how arguments are evaluated, and basically everything is an argument differentiated only by position.
I've head one should read a lisp function not from the top town or outside in, but rather from the most indented part first, and then work your way up and out to discover the definitions.
The whole point of macros is that they are written in the same syntax as everything else (because of homoiconicity you can operate on your code as native data), you don't need to know what is a macro and what is not for 90% of the code you write. There are very little cases in Lisp languages in general where the difference between a macro and a function are evident, and in Clojure even less (compared to another dialect like, let's say, Common Lisp).
There are some times where that might be useful, but that's why we have a repl and macroexpand.
That's why the pipeline operator (->>) is common. Then you just read it from up to down.
https://github.com/stuarthalloway/programming-clojure/blob/m...
https://github.com/tcltk/tcl/blob/master/generic/tclCompile....
Grabbed at random. I think the larger indentation and fewer parens do make a difference when you squint at things.
Of course, I also think as a professional programmer, if something does the job, get over it and get on with it. I use Erlang myself, which also gets lots of syntax complaints.
But if I may, I believe treating inanimate objects as women puts them off more than LISP.