Live data from Hacker News

Try Clojure

tryclojure.org

381–390 of 404 posts

Re: Try Clojure

#381

Clojure is becoming popular in Mexico, and I'm guessing Brazil may see a similar situation, because of nubank. It is a popular destination to go work there for computer scientists, and they seem to work mostly in Clojure. I seem to remember they even employed some of the core members of the language? I think at some point they also bought the company of Jose Valim (Elixir's creator), but I think they are still mostly…

I often encounter Clojure Chinese users (at least Chinese sounding names, don't know about their nationality). I wonder if Clojure is a thing in China ?

no. But because of the population, even 0.0001% of developers using it, it still has an observable impact on the community.

Re: Try Clojure

#382

Earlier quoted context omitted.

I got what you described by learning Common Lisp just a few months ago. Do you think learning Clojure would get me something in addition to that or is it roughly the same?

> Do you think learning Clojure would get me something in addition to that For me, the biggest benefit is that it's hosted. Learning only Clojure, I can easily today write for JVM, .NET, JavaScript, Flutter, or shell scripts. Even when I need to write Lua, I'd usually pick Fennel. It's not Clojure but feels very similar. There are libs that can give you Python or R interop from Clojure. There are projects to target G…

>For me, the biggest benefit is that it's hosted...I can easily today write for JVM, .NET, JavaScript, Flutter, or shell scripts.

Isn't CL better for this? You are not bound to some VM and you can produce native binaries.

Re: Try Clojure

#383
post #263

Earlier quoted context omitted.

This reduces the friction, but doesn't eliminate the needles back and forth. Breaking context locality is just bad The threads example in another comment is way better

There’s no needle back and forth. Everything in parentheses is a complete expression, like a formula. You have the operator (function) and the operands (args). Think of it as add instead of + and multiply instead of *. You get used to it very quicly and then it does not matter.

It's not about thinking differently, it's about operator location, you simply don't know with long nested function what operation is performed at end-3 nest unless you look at beg+3

Re: Try Clojure

#385

I have to admit, several years ago, a colleague of mine advised me if not to try Clojure but at least to read the "History of Clojure": https://dl.acm.org/doi/pdf/10.1145/3386321 , which I never did. But one day I decided to watch Rich Hickey - Greatest Hits https://changelog.com/posts/rich-hickeys-greatest-hits ... I then read the "History of Clojure", and then jumped into learning it. This is probably one of the mo…

I got what you described by learning Common Lisp just a few months ago. Do you think learning Clojure would get me something in addition to that or is it roughly the same?

Clojure uses immutable lists, vectors, hashmaps, and sets. Also it has syntax sugar such as [1 2 3] for vectors, {"Jan" 31 "Feb" 28} for hashmaps, #{1 2 3} for sets, and much more. Also it has multimethods which are even more generic than CLOS.

Re: Try Clojure

#386

Earlier quoted context omitted.

I love this so much. The power of being able to connect a repl to your production instance and fix bugs instantly is hard to understate. It’s actually kind of hard to explain to devs used to deployment cycles measured in weeks

How is the fix committed once you are done? Does this run counter to immutable deployments?

Do not try to "commit" or "immutably deploy" lisp data/code. That's impossible. Instead.. Only try to realize the truth.

There is no "commit" / "deploy".

Re: Try Clojure

#387

Earlier quoted context omitted.

> ...had a spike in popularity despite being very hostile to newcomers. To be fair the community itself, as humans, was very welcoming to newcomers. Really super nice and helpful folks. If anything was "hostile" it was the dominance of emacs and very limited options for other tooling. That, and the horrifically unhelpful leaky abstractions in the stack trace when something went wrong. It's a big step, if you don't al…

the tooling is the reason i gave up when i was interested in learning clojure. everywhere pretty much said that emacs was the "correct" editor to use for clojure, i tried it out for a bit but ultimately learning a new language and a new editor at the same time was just too big of an ask. i tried calva with vscode afterwards but it was basically the same thing, calva has paredit which overrides the keyboard navigation…

Wow. I'm the creator of Calva and I can tell you that I do not have an opinion on how to use it. I would never say something like that, and now I wonder what I could have said that was interpreted this way...

By default Calva Paredit overrides three or so keyboard shortcuts. This is to help the users to not accidentally delete brackets, which in turn keeps the support questions down about broken Clojure code. I have tried to make it super easy to disable these overrides. There's a command for it. There's a button in the toolbar for it, and there's a setting for it.

There's also a setting for removing all Paredit bindings, even those that are not overriding any default ones. (This setting is for people who use Paredit, but want to provide their own shortcuts entirely.)

Re: Try Clojure

#388
post #238

Earlier quoted context omitted.

When you get into REPL-driven development, the JVM startup time (which is often under a second for me anyways) is a total non-issue. You don't continuously restart your program to see changes or run tests. You can refresh all your state instantly without exiting. But before Babashka, that was indeed a barrier to using Clojure in shell scripts. Now we have it all!

Except in Babashka you can't use Java libraries.. Right? I feel a good fraction of code will dip into Java libs at least a bit - so you're limited in what libraries you can use I think the real solution is probably Graal native - though it's not part of the official toolbox/deps.edn

[dead]

Re: Try Clojure

#389
post #144

Earlier quoted context omitted.

This is a good starting point if you want to get a web app going quickly: https://biffweb.com It uses XTDB by default but you can switch to Postgres: https://biffweb.com/p/how-to-use-postgres-with-biff/ People don't really use ORMs in Clojure, they just write SQL directly and abstract the details from consumers using functions. That said, HoneySQL is a common alternative to writing SQL that makes it a lot less painfu…

HoneySQL is so, so good. It does for SQL what Hiccup did for HTML. Once you start writing with those, it's hard to remember there's any other way.

Totally agree! or datalog is even better if you can accept not using the mainstream databases.

Re: Try Clojure

#390
post #98

Earlier quoted context omitted.

Oh wow, this is truly great! Would you have a link to the code behind `(+)` and `(*)` ? (In my functional programming languages, `reduce` also requires passing an initial value, like `foldl (+) 0 [1, 2, 3]`. But surely it should get a monoid instead of two separate arguments for the operation and the starting value!)

Yeah, it always annoys me to have to pass an initial argument. The idea of identities is built into Lisps and seems conspicuously missing from other languages and I don't know why. In Python and JS people have to write stuff like `lambda x: x` over and over again. The identity function is surely special enough to get its own name.

This does not involve an identity function?

It's just a textbook monoid: an operation on two elements which produces another (+ or *), with a "neutral" element provided (0 or 1).

Post reply on HN