News for hackers. Stuff that matters.
Re:Clojure 1.9 is now available by Y_Y on Friday December 08, 2017 @03:21PM (#15881702)
Can anyone sell me on why I should use clojure over say, any of the other nice Lisp-1s, given that I don't care about java.
Re:Clojure 1.9 is now available by neutronicus on Friday December 08, 2017 @03:46PM (#15881893)
Associative data structures (maps / dicts) are super first-class in Clojure, in a way that they aren't in other Lisp-1's (at least from what I remember of dabbling in Racket). There's a literal syntax for them. Keywords are functions that you can call with a map as an argument. You can destructure them in `let` bindings. And so on.

In my opinion, this turns out to be a pretty major win. Code is still data, it's just that this data is a mix of lists, vectors, and maps, and now you can type associative data structures into your code as easily as you can lists. Hash tables in vanilla Common Lisp are a nightmare (there is a nice library that at least gives a Clojure-y initialization option via Reader macro), and a glance at the Racket documentation suggests the story there is probably not much better.

Clojure code in the wild uses the destructuring on maps a lot like, e.g. Haskell code uses pattern matching, and Spec is an interesting core library aimed at allowing libraries to insist that keys be present in maps and so on.

Anyway, I had occasion to interact with some Common Lisp code I'd written several years ago, and I was struck by how annoyed I was at it for not being Clojure. Part of that is the Lisp-2 issue, but I also really missed how lightweight and easy Clojure maps are, and how easy they are to use for control flow. (I will say that Clojure's clunky recursion annoys me, but much less than trying to deal with Hash Tables in CL)

Also, and I know you say you don't care about Java, but ... sometimes you have to interact with some annoying outside system (like, a database or a web browser), and there is a high-quality Java(Script) library that makes this task trivial and lets you work on what you want!

Re:Clojure 1.9 is now available by joncampbelldev on Friday December 08, 2017 @03:56PM (#15881982)
Also on the subject of clojure's data structures, they are all immutable by default (with structural sharing so changes are efficient, not just defensive copys). This greatly assists in writing functional, multi-threaded code.

For original asker, see here for more details: https://clojure.org/reference/data_structures

Re:Clojure 1.9 is now available by flavio81 on Friday December 08, 2017 @04:41PM (#15882303)
>Hash tables in vanilla Common Lisp are a nightmare

I seriously disagree with such a statement.

Also, i feel confused that a lisp being a Lisp-2 could be an "issue". Separate namespaces for functions, symbols, classes, labels and so on is great, because they dramatically simplify naming things, which is one very important task for writing clean, readable, maintenable code.

Re:Clojure 1.9 is now available by threatofrain on Friday December 08, 2017 @04:57PM (#15882418)
After using a Lisp for awhile I've come to feel that privileged symbols improves ability to mentally acquire some code.

It was an okay learning journey, but it left me hungering for an easier FP language, and it also solidified my intuition that simple is both easy and hard at the same time, and Lisp is simple.

Re:Clojure 1.9 is now available by catnaroek on Saturday December 09, 2017 @09:20AM (#15885895)
> Associative data structures (maps / dicts) are super first-class in Clojure

“First-class”, you keep using that word. I do not think it means what you think it means. See here for the details: https://en.wikipedia.org/wiki/First-class_citizen . tl;dr: First-class-ness is about semantics, not syntax. And, while every language (including Racket) is broken in some ways, it's not broken enough for associative data structures to be inexpressible in it.

> There's a literal syntax for them.

Why does this matter in a language with macros anyway?

Re:Clojure 1.9 is now available by emidln on Saturday December 09, 2017 @10:54AM (#15886301)
>> There's a literal syntax for them.

> Why does this matter in a language with macros anyway

If you don't have this, you end up with a bunch of read table syntaxes for the same thing. These usually don't play nicely together. See Common Lisp libraries (since CL doesn't provide this syntax in the standard) for all the subtly incompatible hash table read syntaxes and printer implementations you can stomach.

Re:Clojure 1.9 is now available by catnaroek on Saturday December 09, 2017 @11:55AM (#15886635)
The solution to this specific problem is library standardization, not hardcoding more data structures into the core language.
Re:Clojure 1.9 is now available by adrianm on Friday December 08, 2017 @03:48PM (#15881909)
I am a big fan of all Lisps (you will pry my Common Lisp REPL out of my cold, dead hands!), but there is only one that which has elevated both my hobby and professional work into a realm I can honestly describe as fun and intellectually stimulating even years after the honeymoon period has waned. That Lisp is Clojure.
Re:Clojure 1.9 is now available by unit91 on Friday December 08, 2017 @03:31PM (#15881779)
I wouldn't try to sell you on it. Languages are tools, so your question is like asking "can anyone sell me on why I should use a flashlight instead of a cheese grater?" I don't know, because I don't know what you're trying to do. Perhaps neither Clojure nor Lisp is appropriate. Basic sales pitch: use the right tool for the job.

For many of us, Clojure(Script) is the right tool: a balance of performance, ecosystem interoperability, expressiveness, etc. on the platform we're targeting.

Re:Clojure 1.9 is now available by nikki93 on Friday December 08, 2017 @03:58PM (#15881990)
You've well captured a sentiment I feel when questions are phrased this way -- "can you sell me on X." Thanks for posting and showing me this. :)
Re:Clojure 1.9 is now available by flavio81 on Friday December 08, 2017 @04:17PM (#15882115)
>Can anyone sell me on why I should use clojure over say, any of the other nice Lisp-1s, given that I don't care about java.

It's the same question I make myself, since after learning Clojure here I am, still using Common Lisp happily ever after.

Well, if you think that data should be immutable by default,

if you really need readymade syntax sugar for hash table and the likes,

if you don't have any need for object oriented programming, not even once a year, and if you particularly don't feel any appeal for what is by far the most advanced OOP system out there (CLOS),

if you love the Java ecosystem and need to be reminded of the J2SE libraries by using them directly all the time to do things other languages have built inside their own stdlib (but Clojure does not),

if you don't feel wrong knowing that your code won't be compatible with the .NET CLR (or other platforms) without rewriting substantial parts, despite the language still being called "Clojure",

if you don't know that basically all you can do with Clojure, including talking to Java (and also C) libs, and all sorts of concurrency things, you can also do with good old, high performance Common Lisp...

... then welcome to Clojure! Clojure is easy to learn, fashionable, well supported, and popular.

I guess that if you are into developing single page applications, Clojure can be a neat choice.

Re:Clojure 1.9 is now available by DigitalJack on Saturday December 09, 2017 @12:28AM (#15884471)
Well that was condescending.
Re:Clojure 1.9 is now available by flavio81 on Saturday December 09, 2017 @01:29AM (#15884616)
More disillusionment than condescending. I jumped on learning Clojure waiting for big, nice surprises, new stuff, or an enlightening moment, but there wasn't any.

I do, however, find it easy to learn and that's a good thing.

On the other hand i am not really knocking down Clojure. If somebody wants me to do a project that requires interacting with lots of Java classes, I'm really glad Clojure exists, since it liberates us from plain Java. I am also glad that it's a good "gateway drug" to Lisps in general. I'm also glad that ClojureScript exists, perhaps this is the best part of Clojure.

But Clojure is not really my cup of tea. I want wide options for mutable data (for performance reasons). I want multiple paradigms, including a powerful OOP system. I want easy recursion with tail call optimization. I want explicit, detailed error messages, etc.

Re:Clojure 1.9 is now available by simongray on Saturday December 09, 2017 @02:36AM (#15884737)
I think your description is fair, although I feel like you could have started with the Clojure/ClojureScript combo for making SPAs in your first comment. That is really the biggest driver of Clojure right now, the fact that it has a mature compile-to-JS implementation that can share source code with the backend.
Re:Clojure 1.9 is now available by flavio81 on Saturday December 09, 2017 @08:58AM (#15885804)
I think ClojureScript is very nice and I often recommend it to any Javascripter.

I sincerely thank Hickey for liberating us from Java and plain Javascript. I think that if Clojure was pitched more as substitutes of Javaxx and less as "the improvement over Lisp", many of us Lispers would be happy. As I mentioned, it isn't an improved Lisp; it is a different language with a different (valid) philosophy which some will like.

Re:Clojure 1.9 is now available by thom on Saturday December 09, 2017 @12:47PM (#15886957)
Clojure's just a bunch of specific pragmatic decisions bunged into a Lisp. If you've never had a problem selling, deploying and integrating Common Lisp apps for clients then it sounds like it would be of dubious utility to you. People will argue all your individual points because that's what people do, but honestly, you're fine, Clojure's fine, everyone's fine.
Re:Clojure 1.9 is now available by cutler on Saturday December 09, 2017 @06:54AM (#15885425)
A small detail - Clojure has 20,000 libraries of its own. See http://clojars.org .
Re:Clojure 1.9 is now available by flavio81 on Saturday December 09, 2017 @09:18AM (#15885890)
Npm (javascript's NPM) has over 500,000 libraries right now. Do this makes JS a better language than Clojure, or a better choice? No way. And everytime some javascript fan would go against Clj/ClojureScript use citing "Clojure has 25x less libraries", i will defend Clojure.

How many libs do we really need? So far i have found all libs I needed for Common Lisp. Many of them have high quality, at least in the sense that the code is easy to understand.

Most needed stuff is there - db access, key/value store, cryptography, authentication, html templating, JSON, xml, web servers, software transactional memory, parallelization, compression, networking, foreign interfaces, music, midi, all sorts of data structures, and of course tons of AI related stuff. This is not like NPM where there is a lib solely dedicated solely to left-padding a string, and when you take down this lib the whole ecosystem collapses big-time (true story).

Also, just as Clojure can easily call Java code and thus have access to the huge and mature Java lib ecosystem, also Common Lisp can very easily (see 'CFFI') access the huge and mature C lib ecosystem, mind you, and this feature is leveraged a lot in CL. This also has performance benefits, since tuned Lisp code is as fast as tuned Java code, but C can often go faster. With ABCL (JVM implementation of Common Lisp), you can even call Java libs and C libs in the very same source code, which I find amazing.

Re:Clojure 1.9 is now available by cutler on Saturday December 09, 2017 @08:33PM (#15889261)
I was actually praising Clojure, ie. doesn't necessarily depend on Java libraries.
Re:Clojure 1.9 is now available by fulafel on Saturday December 09, 2017 @04:36AM (#15885034)
Protocols cover many OO use cases.
Re:Clojure 1.9 is now available by systems on Friday December 08, 2017 @04:26PM (#15882183)
If you need to force yourself, or if you need extra special motivation to use Clojure .. most likely you will never use it

You might spend sometime learning it out of curiosity, but you will never use it

The languages I used, are ones I had to use, either because they were the only option, or clearly the best option for my solution (C#, VB.Net, Powershell, SQL)

Clojure will never be your only option, and .. it being the best option is highly subjective

I tried to like Clojure, because of all the blogs and talks, and the reputation of it being a smart language for smart people (I obviously, wanted to belong to this group, and still do) .. but for my work, and use cases (Business Intelligence), it will never be the best option, or the only option

The same list that include Clojure, for me also include F#, D, Dart, Ada 2012, Idris, Julia, Rust .. I am sure since you asked this question, you have your own list too .. and you know, nothing will really work to motivate you

Re:Clojure 1.9 is now available by jcadam on Friday December 08, 2017 @08:34PM (#15883679)
Clojure is the best option for me, on my own projects, because I like it and I'm more productive in it (this applies to Lisp in general, I suppose) than any other language I've tried. And when I'm working alone, that's all that matters :D

Now, when I'm working on a team... I must tell you I live in Florida and if I've ever met another Clojure/Lisp programmer in meatspace I'm not aware of it (and I'd be surprised). In fact, most of the Java developers I work with only really know Java (and some are helpless without Eclipse). So recommending anything that isn't Java probably wouldn't be wise. So, yea.

Re:Clojure 1.9 is now available by KingMob on Saturday December 09, 2017 @12:42PM (#15886920)
Hey, if you're anywhere near Melbourne, check out Swarmify! We use Clojure(Script).
Re:Clojure 1.9 is now available by jcadam on Sunday December 10, 2017 @02:29PM (#15893046)
Yea, I'm in Satellite Beach. Think I even interviewed (just a phone screen, really) with Swarmify a couple of years back before I had really gotten into Clojure.
Re:Clojure 1.9 is now available by raspasov on Friday December 08, 2017 @10:10PM (#15884066)
I'm quite surprised by your conclusion that Clojure "is not the best option" for Business Intelligence. What general purpose language is better for that in your opinion?

There's a difference between "best tool for the job" and "most widely used tool for the job" at this moment in time. People's habits sometimes take years or decades to break (if they ever do).

Re:Clojure 1.9 is now available by simongray on Saturday December 09, 2017 @02:41AM (#15884750)
Clojure as a data-oriented language is great in itself, but I can see why someone would choose say R or Python for BI/data science due to the ecosystem. Clojure can of course freeride on the Java or JS ecosystems, but I don't think those ecosystems offer the same breadth as R or Python either.
Re:Clojure 1.9 is now available by cutler on Saturday December 09, 2017 @06:50AM (#15885414)
Try Hy (http://hylang.org) - an excellent Clojure-like Lisp in Python.
Re:Clojure 1.9 is now available by DigitalJack on Saturday December 09, 2017 @12:30AM (#15884474)
"If you need to force yourself, or if you need extra special motivation to use Clojure .. most likely you will never use it"

Amen. Learning is best a journey of desire, not compulsion.

Re:Clojure 1.9 is now available by giblet on Friday December 08, 2017 @03:28PM (#15881750)
Re:Clojure 1.9 is now available by geofft on Friday December 08, 2017 @03:50PM (#15881926)
I am planning on learning Clojure for essentially two reasons: the community / ecosystem seems very active (which is really my primary reason for picking a programming language; I have no interest in writing something if a library exists), and I've heard good things about a couple of things that distinguish it from other Lisps, like maps and spec.

I'm somewhere between indifferent to unhappy that it runs on the JVM, but it's not a blocker for me. And as someone else mentions, it means there's pretty good access to the Java library ecosystem.

Re:Clojure 1.9 is now available by simongray on Saturday December 09, 2017 @02:45AM (#15884764)
The good thing about Clojure is not that it's not married to the JVM. I think the JS implementation has been carrying the torch for the past year because of the many excellent front-end frameworks based on React, which are oddly faster than just using React in JS due to the code-optimisations performed by the ClojureScript compiler and Google Closure. It also has one of the best front-end dev experience in the shape of figwheel, which has become the default for all front-end dev in the language.
Re:Clojure 1.9 is now available by koolba on Friday December 08, 2017 @03:27PM (#15881742)
Running on a JVM opens up access to a huge ecosystem of drivers, platforms, and integrations. Any new libraries written for Java can be trivially accessed from Clojure.
Re:Clojure 1.9 is now available by titanix88 on Saturday December 09, 2017 @12:57AM (#15884543)
One very important aspect of Clojure is lock-less, STM(software transactional memory) based concurrency that just works. In clojure, shared memory is readily available and with a few lines of code, you can get rid of entire third party projects typically used for in-memory caching, message-passing and background job processing. This is a huge win if you are writing long running server applications.
Re:Clojure 1.9 is now available by flavio81 on Saturday December 09, 2017 @01:50AM (#15884643)
>readily available and with a few lines of code

1. Declare the classes you want to work under transactional memory as transactional... by wrapping them in such a way:

    (transactional (defclass ...))
2. Whenever you need to do a STM transaction, just wrap the critical code within (atomic):

    (atomic (do-stuff ...  ))
Is it hard? Nope. The above example is one easy way to do it in Common Lisp, using the STMX library, which of course you can download, compile and load with one line of code:

    (ql:quickload "stmx")
So yes, it is easy under Clojure, but not only in Clojure.
Re:Clojure 1.9 is now available by escherize on Friday December 08, 2017 @03:32PM (#15881791)
Immutable by default

Lots of support

Great interactive workflow (with Emacs, Intellij, or Atom)

Data oriented (Most of your code are pure functions making

simple operations on datastructures)

Re:Clojure 1.9 is now available by tensor on Friday December 08, 2017 @03:30PM (#15881778)
It has a strong focus on immutable data structures and good concurrency primitives. True that you can get these in libraries for other lisps, but having the entire eco-system based on them is a big selling point.
Re:Clojure 1.9 is now available by aeorgnoieang on Friday December 08, 2017 @03:29PM (#15881767)
If you're indifferent to Java then you can use a Lisp that just so happens to let you interop with Java libraries which is very very handy.

It's also a nice Lisp, tho not as pure or quite as powerful as others.

But I'm not very much up-to-date on anything new in the past few years, and I was never a guru anyways, so maybe there are better pitches.

Re:Clojure 1.9 is now available by m1n1 on Friday December 08, 2017 @04:04PM (#15882032)
Do you have a favorite accessible guide to comparisons of lisps with respect to purity and power?
Re:Clojure 1.9 is now available by simongray on Saturday December 09, 2017 @02:52AM (#15884777)
The main "unpure" parts of Clojure is that

* it doesn't do tail call optimisation unless you explicitly mark the self-call using by using recur (the lack of implicit TCO is a JVM limitation) * it doesn't use macros as much, although they are they're there and still used pretty often * it has language literals for the built-in data structures that look odd to other LISP'ers, e.g. {...} #{...} [...] * it's error messages are ecosystem dependent, e.g. Java stack traces for Clojure or and JS ones for ClojureScript

Re:Clojure 1.9 is now available by raspasov on Friday December 08, 2017 @10:03PM (#15884032)
+ exceptionally well designed "immutability by default": reduces accidental complexity to a minimum and lets you focus on the problem at hand

+ ClojureScript: allows you to write Clojure for any JavaScript platform (web, ReactNative iOS/Android, node.js) while writing 97% the same language excluding any platform-specific differences between the JVM and the JavaScript runtimes (V8, JavaScriptCore, etc)

+ piggyback on the entire mature+stable+performant JVM ecosystem of

... + tools (Maven >> npm, cocoapods, et al)

... + libraries (Netty, JodaTime, etc)

Re:Clojure 1.9 is now available by indigo0086 on Friday December 08, 2017 @06:14PM (#15882946)
I think the age of convincing other people to use a language is over, you have to find that out for yourself, like I imagine many of use who love clojure have done.
Re:Clojure 1.9 is now available by oneweekwonder on Friday December 08, 2017 @03:51PM (#15881937)
Something I like about it is that it runs on different vm's: java, .net and js.

Not sure how usable the .net part is.

Re:Clojure 1.9 is now available by puredanger on Friday December 08, 2017 @03:53PM (#15881959)
The .net part hasn't released a version on parity with Clojure 1.9 yet, but it is up to date with 1.8. Not many people use it, but it is quite usable. The core was developed by Rich in tandem with the JVM version until Clojure 1.0.
Re:Clojure 1.9 is now available by _sdegutis on Friday December 08, 2017 @11:10PM (#15884240)
Having spent 10,000 hours writing Clojure code professionally, I feel confident in saying that the main selling point for Clojure is that it's a simple dynamic JVM language with very little magic. If you don't need to use any Java libraries or have any hard requirements on deploying JAR files, then Clojure probably isn't what you need. Personally if using a Lisp-1 was a hard requirement, I'd be looking into Racket.
Re:Clojure 1.9 is now available by thom on Saturday December 09, 2017 @09:09AM (#15885852)
Might help to hear the man himself explain the motivations:

https://www.youtube.com/watch?v=2V1FtfBDsLU

Re:Clojure 1.9 is now available by noncoml on Friday December 08, 2017 @03:26PM (#15881735)
Libraries/Ecosystem
Re:Clojure 1.9 is now available by YuriNiyazov on Friday December 08, 2017 @03:25PM (#15881729)
Do you develop in JavaScript either front or back?
Re:Clojure 1.9 is now available by Y_Y on Friday December 08, 2017 @05:58PM (#15882860)
Not when I can avoid it ;) My real work is HPC, but I'm looking at this from a hobby perspective.
Re:Clojure 1.9 is now available by YuriNiyazov on Friday December 08, 2017 @07:57PM (#15883485)
I actually don't think Clojure is a good hobby language; it has specific opinions that are there to help you make good design decisions in large scale systems, but in small projects they just get in the way.
Re:Clojure 1.9 is now available by barkingcat on Friday December 08, 2017 @03:44PM (#15881880)
Why would anyone want to sell you on something?

Do you want to be sold on it? Is that what you want your interactions on this site to be?

Re:Clojure 1.9 is now available by Y_Y on Friday December 08, 2017 @04:43PM (#15882319)
Some people probably like it. They've had a good experience with it, that they'd like to pass along. I feel this way about several thing and will happily evangelise to someone who seems willing. I was inviting others to do that . Several of them have responded as I expected and provided lots of interesting information.

Since I achieved my aim and stimulated some useful and on-topic discussion, yes, this is what I want my interactions on this site to be. Thanks for asking.

Re:Clojure 1.9 is now available by cup-of-tea on Tuesday December 12, 2017 @09:00AM (#15905588)
You should watch Rich Hickey's talk "Clojure for Lisp Programmers" https://www.youtube.com/watch?v=cPNkH-7PRTk https://www.youtube.com/watch?v=7mbcYxHO0nM