Live data from Hacker News

Try Clojure

tryclojure.org

341–350 of 404 posts

Re: Try Clojure

#341

Earlier quoted context omitted.

Functional programming languages haven't gone mainstream but functional techniques are very common now. Higher order functions, immutable data structures, declarative UI frameworks, etc are things you're quite likely to encounter in a contemporary codebase these days.

That's what I said. I do use functional programming techniques, I just wonder why functional programming languages don't see a larger following.

I didn't get anything close to that from your original message. I thought you meant "I write functional JS, but am wondering why a language like clojure or OCaml isn't more popular"

Re: Try Clojure

#342

Earlier quoted context omitted.

I recently went through most of the Biff tutorial but found it seemed to be missing some parts later on that had me scratching my head. It was otherwise a very enjoyable experience and Biff seems like a great way to get a "batteries included" starting point for web (similar to something like Rails or Django, though maybe not as comprehensive as either of those).

Mind sharing the parts of the tutorial you had trouble with, if you remember?

I'll see if I can go back and figure out where I lost track of things. I believe it was right around when making the message entry box functional. I ended up having to dig into the repo to see what I was missing.

Re: Try Clojure

#343
post #337

Earlier quoted context omitted.

JS has this error too, but nothing forces Java to have this issue if they fix the no-mutable-captures problem. Dart got this right from the start. Here's JS showing the same issue. for (var i = 0; i i) } array.forEach((fn) => console.log(fn())) // Prints 10 every time. The correct fix is that each loop iteration gets a fresh i instead of i just being mutated. Currently you can't see the difference in Java between the…

Here's what I'd do: array = []; function clos(val) { return () => val; } for (var i = 0; i console.log(fn())); This outputs 0-9 instead of 10, though I'm just a silly self-taught person that never got schooled at these things, maybe there is some reason not to use closures that I don't know about.

These days in JS you can just use let instead of var and it will work, but in itself that inconsistency is a bit weird

Re: Try Clojure

#344
post #270

Earlier quoted context omitted.

I may be wrong, but I think the parent poster was talking more about the language and ecosystem than the community. I, too, have found the community to be amazing. But the language itself used to be quite frustrating to learn. It's better now, but I think that by the time it got fixed many companies and teams had already been burned. Clojure is particularly vulnerable to that because it really is an enterprise applic…

Yes, I agree with you, learning is complicated, because it's mostly un-learning habits you had for 20+ years. Stack traces suck, but after a while you grok them. The clojure/core is full of niceties, but it's so big you need a map just to know what's in there. And still...

[deleted]

Re: Try Clojure

#345

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 ?

Re: Try Clojure

#346

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?

Clojure also teaches you functional programming, where-as CL only teaches you the LISP beauty. Clojure teaches you both Lisp and Fp. So the FP part should still be worth it even though you got the Lisp part from CL.

How does fp in clojure differ from fp on common lisp?

Re: Try Clojure

#347
post #145
post #110

Earlier quoted context omitted.

Should have maintained a python interoperable runtime. Less and less people use JVM languages for things like web apps, data eng, data science, ML, etc.

Give https://github.com/basilisp-lang/basilisp a try

Briefly looking through this it reminds me of hy

Re: Try Clojure

#348

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…

> It went away for a while for reasons I'm unclear on.

The creator, Anthony Grimes (https://github.com/Raynes), sadly passed away seven years ago: https://www.reddit.com/r/Clojure/comments/5gyyxw/clojure_ope...

Re: Try Clojure

#350
post #98

Earlier quoted context omitted.

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.

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!)

Source code:

+: https://github.com/clojure/clojure/blob/clojure-1.11.1/src/c...

*: https://github.com/clojure/clojure/blob/clojure-1.11.1/src/c...

Docs:

+: https://clojuredocs.org/clojure.core/%2B

*: https://clojuredocs.org/clojure.core/*

Post reply on HN