Live data from Hacker News

Try Clojure

tryclojure.org

31–40 of 404 posts

Re: Try Clojure

#31
post #22
post #4

I love clojure, but it's really lost a lot of the momentum it had as many imperative languages have adopted parts of functional programming (and much for the better) over the last many years. On the other side I've felt a lot of the ecosystem work that was done has a more "timeless" quality. Coupled with java interop I haven't ever felt wanting when I do reach for it for some hobby projects I keep up with. One thing…

In my experience, the subsets of the community around clojure were one of the biggest problem with it. It's gotten better over the years, but circa 2016 - 2018 it had a spike in popularity despite being very hostile to newcomers. There was an almost apologist attitude towards rough edges or failure modes folks new to the community would fall into. I managed to work with it for a time despite that, but it left me with…

YMMV. I always found it very welcoming and full of interesting people.

Re: Try Clojure

#32
post #18
post #8

Cool site, I've never tried Clojure before. My first reaction though is that (+ 1 1) is a highly unconventional and possibly confusing way of writing 1+1, and I'm not sure why that design choice came about.

+ is a function, there are no operators in Clojure. That allows for some nifty tricks like: (reduce + [1 2 3]) ; returns 6

Another neat thing is that these functions are n-ary, and that includes 0 args. So (+) => 0 (additive identity) and (*) => 1 (multiplicative identity). Little things like this are missing from languages like Python and make functional programming worse than it should be.

Re: Try Clojure

#33
post #8

Cool site, I've never tried Clojure before. My first reaction though is that (+ 1 1) is a highly unconventional and possibly confusing way of writing 1+1, and I'm not sure why that design choice came about.

Your comment is a highly unconventional and possibly confusing way of writing... to a Chinese person ;)

Re: Try Clojure

#34

Earlier quoted context omitted.

In prefix notation (which has been around for a very long time) the operation comes first. Think of it as the "addition" function being applied to the arguments following it. This matches how nearly all programming languages are broken down into their abstract syntax trees while compiling. As an added bonus, you now know Lisp. This is how all Lisp syntax works: `(function arg1 arg2 ...)`. That's literally it.

[flagged]

"Typical convention" is also an Appeal to Tradition. Different traditions though!

Incidentally, people used to be /really/ against Python because of its use of significant whitespace. The number of people who bounced off it because they would try to type something and then get a mysterious syntax error that turned out to be that they didn't type space or tab the right amount of times! It used to be what people would immediately post whenever anyone said anything about Python.

I think now people get introduced to IDEs at the same time as Python, or something happens at that early teaching moment that gets them over that hump. The same, in theory at least, happens when you play with a lisp long enough.

Re: Try Clojure

#35
post #22
post #4

I love clojure, but it's really lost a lot of the momentum it had as many imperative languages have adopted parts of functional programming (and much for the better) over the last many years. On the other side I've felt a lot of the ecosystem work that was done has a more "timeless" quality. Coupled with java interop I haven't ever felt wanting when I do reach for it for some hobby projects I keep up with. One thing…

In my experience, the subsets of the community around clojure were one of the biggest problem with it. It's gotten better over the years, but circa 2016 - 2018 it had a spike in popularity despite being very hostile to newcomers. There was an almost apologist attitude towards rough edges or failure modes folks new to the community would fall into. I managed to work with it for a time despite that, but it left me with…

  > ...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 already know emacs to learn emacs (at a fairly advanced level) AND a new very different programming language.

I see now there's a vscode option with Calva. I haven't tried it. Might do that someday. Really wanted to like this language!

Re: Try Clojure

#36

Maybe online "learn lisp" repls should implement paredit keybindings in their editor and have a short section on how to manipulate s-expressions. Because you're gonna have to learn it to use the language, but it also helps people understand from the start that "oh, so using the language isn't actually complete shit". Instead, this fact always seems glossed over, and because of it anyone who spends 60 seconds writing…

I spent a few months writing a decent sized Clojure program just using my IDE's matching bracket highlighting and some sort of rainbow parentheses settings, and never found it very annoying. I'm not sure there are that many more parentheses than curly-bracket languages, it's just that all of the closing parentheses are more likely to cluster together at the end.

Re: Try Clojure

#39
post #8

Cool site, I've never tried Clojure before. My first reaction though is that (+ 1 1) is a highly unconventional and possibly confusing way of writing 1+1, and I'm not sure why that design choice came about.

On the contrary - I think it's much easier! The real advantage of this notation is that it's much, much easier to stack calculations. Example: (/ (+ 34 68 12 9 20) 140) You can imagine how the first part of that could come about: (+ 34 68 12 9 20) And then the second part (pseudocode): (/ sum 140) In Clojure it's easy to mash them together, or for example to paste the first calculation in the second. (/ (+ 34 68 12 9…

> (* (/ (+ 34 68 12 9 20) 140) 1.5 2)

The problem with that is by the time I reach `20)` I have already forgotten what operation I'm in. I'd write it more like this:

    (* 
      (/ (+ 34 68 12 9 20) 
         140) 
      1.5 2)
actually I'd write this as

    (/ 
       (* 2 (/ 3 2) (+ 34 68 12 9 20))
       140)
> ((34 + 68 + 12 + 9 + 20) / 140) * 1.5 * 2

Why not (34 + 68 + 12 + 9 + 20) * 1.5 * 2 / 140?

Re: Try Clojure

#40
My Clojure experience was that basic dev experience things were shockingly behind where any other moderately popular lang is at. It's been some time though so all I remember clearly is bad error output. Stack traces are hard to read unless you install $random_lib. But worse than stack traces are type errors/"Java errors": if you give the wrong args to a function, the error output is completely inscrutable, generally a very short string like `java.lang.Foo does not implement IBar`, which is only helpful if you kind of know how the Java layer works and all your args are different enough types that you can guess which one it's talking about (bonus: anything function-like is just `IFn` so good luck). Ahhh and that made me remember: the doc situation even for stdlib is bad. Everyone around me used a third-party site clojuredocs.org which has broken-formatted auto-ingested versions of the plaintext official doc strings, because it is still the least bad option. No one has decided on a docstring format. No one has decided on code stylistic things either, which has mostly precluded the existence of auto-formatter tools.

The lang itself is good and I recommend folks use a LISP sometime. I was just genuinely surprised a 17-year-old lang was lacking in these areas, and I'd be pretty careful about setting out on a long-term project with it, unless all of those things have radically improved from 6 months ago.

(And like other folks said, you genuinely need editor integrations to not be wasting all your time on pren balancing. Not clj's fault, just LISPs in general.)

Post reply on HN