Live data from Hacker News

Try Clojure

tryclojure.org

251–260 of 404 posts

Re: Try Clojure

#252
post #184

Earlier quoted context omitted.

https://xkcd.com/927/

I'm not sure if you meant this as evidence for or against my point, but this is exactly what I mean. Every year dozens of people think they're going to make some holy-grail language and it's 1% different from the prior version but now every single library needs to be rewritten, a dozen years of patches/bugs/security-holes must happen, whole resumes get shined up rewriting tech stacks that were perfectly capable, all…

Is that how you see people that know several natural languages? You think they're intellectually fractured?

Re: Try Clojure

#253
post #197

Earlier quoted context omitted.

There's nothing baloney about SSA form. I'm sorry to say it, but C is just not close to the metal any more. Even if you are able to hand optimise something so it works well on one architecture, it likely won't be optimal for another. As for Haskell, it does pretty well being 100 times faster than Python with 100 times less the number of people working on it.

I believe that your interpretation of what’s actually happening is what’s baloney. The fact is that you Haskell people only talk about the optimizations that can sometimes open on immutable data in specific circumstances. What you generally ignore is the optimizations that immutable data permanently locks you out of with no recourse. As with most things programming, immutability should be considered a tool, not a rul…

> I believe that your interpretation of what’s actually happening is what’s baloney.

I'm actually quoting Prof Andrew Appel of Princeton: https://www.cs.princeton.edu/~appel/papers/ssafun.pdf

You seem to think that functional programming and in-place updates are mutually exclusive. This is not the case, e.g. Haskell supports mutation as a tracked and controlled side-effect. It can even give static guarantees that a function is pure even it uses mutation internally. Recent research even suggests that compilers can add the in-place updates for us: https://www.microsoft.com/en-us/research/publication/fp2-ful...

Re: Try Clojure

#254
post #211
post #195

Earlier quoted context omitted.

In practice I do wrap `jdbc/execute!` with my own `execute!` function to set some default options. However, there is no ORM layer. What makes you think the code above is terribly unproductive? Edit: Not trying to dismiss your concerns, by the way. In Clojure you can often get away with doing less than you might think so I'm genuinely curious about the critique.

In Django I would just do Posts.objects.filter(title=x) I don't need to define driver boilerplate for every query (or ever have to write it... at all).

The key thing is experienced Clojure programmers often see a lack of ORM as a feature rather than an oversight. There were some more ORM-like libraries years ago (see Korma) but my impression is that people ultimately didn't want this and moved on to lower-level JDBC wrappers combined with HoneySQL. I found a more detailed discussion on Reddit about Clojure and ORMs back in 2020 if you want to get more info: https://reddit.com/r/Clojure/comments/g7qyoy/why_does_orm_ha...

Note that I'm not making a value judgement about Python/Django or any other library/framework combination. It's obviously a valid path, but Clojure is a different path. I can assure you there are straightforward solutions to create readable APIs like the Django example with minimal boilerplate, but the approach is fundamentally different from Python/Django.

If you do decide to build something in Clojure and think, "I already know how to do this in Django, why is it missing?", don't hesitate to join the Clojurians Slack and hop into the #beginners channel. There are plenty of people who can help you there.

Re: Try Clojure

#255
post #129
post #53

Earlier quoted context omitted.

Cursive plugin for IntelliJ is a fantastic option, it's not free but it is excellent.

it's nice, but I used to write Java, and even getting IntelliJ setup on my laptop took a lot of fiddling with JVM versions and getting it to recognize my Clojure install. To this day, I will still have weird issues where Cursive won't run a project, and Emacs will. All that being said, I do really like Cursive.

I use https://sdkman.io/ to manage JVM versions, have you tried that? I haven't used Cursive, maybe it does something weird, but in general IntelliJ seems to accept it just fine in my everyday work.

Re: Try Clojure

#256
post #90
post #79

Earlier quoted context omitted.

As a side note, I'm always amazed by people who can use a highly expressive language (Clojure, Rust, even TS) but switch to Go when they feel like it (especially pre-1.18). To me, switching to a less expressive language is painful and infuriating. I remember having to switch from Python to Java 5, and how everything started to take 3 to 5 times longer code to express. Maybe the key thing is to only write small things…

Development in Go will always be more painful for some people than in Clojure or TS, because the language is intentionally hostile to abstraction, so you're thinking in higher level concepts, but you implement them in more steps than necessary. The program can never reflect the shape of the problem, because it will be riddled with "glue code" that implements the obvious dull steps that you abstract away when reasonin…

> The program can never reflect the shape of the problem, because it will be riddled with "glue code" that implements the obvious dull steps that you abstract away when reasoning.

How does this affect readability when one tries to dive into an existing Go project? Is Go code harder to navigate than code in more expressive languages?

Re: Try Clojure

#257

What's the recommended stack for doing front end development with clojure these days?

Here is where I'd start for the path of least resistance while still using the most modern libraries:

- Dependency management: https://clojure.org/guides/deps_and_cli

- Clojure->JS compiler: https://github.com/thheller/shadow-cljs

- React integration: https://github.com/reagent-project/reagent

- Global state management (optional): https://github.com/day8/re-frame

You might also want a CSS framework. There are some options to write CSS in ClojureScript, but I prefer TailwindCSS which isn't a Clojure-specific thing and it works fine out-of-the-box with `.cljs` files.

You can swap out Reagent for Helix, which is a lower-level and faster wrapper for React. That said, Reagent does work with React 18 just fine and there's tons of docs for it, so jumping to Helix first is a premature optimization IMO, especially if you're new to Clojure.

Re: Try Clojure

#258
The problem I see with clojure, isn't it missing autocompletes? You work with JVM/typescript libraries, but your editor isn't smart enough to pull types from those into clojure. That slows you down tremendously.

Re: Try Clojure

#259
the best reason to learn clojure is reagent[1], by far the best way to use react.

shadow-cljs[2] makes using npm libraries easy.

i’ve settled on go backends and reagent frontends as my default setup[3].

1. https://reagent-project.github.io/

2. https://github.com/thheller/shadow-cljs

3. https://github.com/nathants/aws-gocljs

Re: Try Clojure

#260

I'm glad this is back. A version of this existed in the ancient past and helped encourage me to try Clojure which ended up being by far the most impactful decision in my professional life. It went away for a while for reasons I'm unclear on. I use Clojure nearly daily at my job and at home. Sometimes it's standard Clojure, sometimes it's the excellent Babashka flavor which I use as a make-like task runner and Zsh-lik…

The "j" is always what put me off from learning Clojure. I've had too many bad experiences with JDKs and JVMs that I stay a thousand kilometers away from any thing that has "J" in it unless it's referring to JavaScript.
Post reply on HN