Live data from Hacker News

Why I Switched from Python to Clojure (2016)

bradcypert.com

21–30 of 200 posts

Re: Why I Switched from Python to Clojure (2016)

#21
I don't have a horse in this race but I find it interesting that in my career I've seen a lot of bad code but the worst clusterfucks I've met where all in Clojure while the community seems to be chock full of purists and in general people that takes craftmanship seriously at least at face value.

¯\_(ツ)_/¯

Re: Why I Switched from Python to Clojure (2016)

#22
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

Try, it's wonderful. The best. I write C and Python for a living.

Re: Why I Switched from Python to Clojure (2016)

#23

I notice this was written in 2016, but I wonder if the author's opinion has changed since dataclasses have been implemented in Python.

The author switched to kotlin from clojure, kotlin's interop with java is leagues ahead of clojure.

I do not have experience with Kotlin and it's interop with Java. Do you maybe have examples or articles which you'd recommend on the subject?

Re: Why I Switched from Python to Clojure (2016)

#24
post #8

Earlier quoted context omitted.

Python's async support also seems to be getting better. There's a flask clone called Quart ( http://pgjones.gitlab.io/quart/ ) and an async postgres client ( https://github.com/MagicStack/asyncpg ). It works very similar to JavaScript, with async and await keywords. I think it should provide speed and comfort especially if you're a regular JavaScript user.

I wrote a pretty substantial experiment using asyncio for 100k websocket client connections across a massive theoretical fleet of robots. It's not open source but the general result was that I used to hate async in Python and now I love it. The syntax makes blending sync and async easy. And the cooperative multitasking paradigm is very easy to reason about. No locks!

[deleted]

Re: Why I Switched from Python to Clojure (2016)

#25

I notice this was written in 2016, but I wonder if the author's opinion has changed since dataclasses have been implemented in Python.

The author switched to kotlin from clojure, kotlin's interop with java is leagues ahead of clojure.

May I suggest Kawa (https://www.gnu.org/software/kawa) if you're open to Lisp-style syntax (Kawa is a Scheme dialect)? Kawa has great Java interoperability, Java-like performance (with the help of optional type declarations), a nice REPL, full documentation, maturity (continuous development since 1996), and many neat features. It doesn't require special tools or workflow. (I do suggest using the git version, as it is overdue for a release.)

Re: Why I Switched from Python to Clojure (2016)

#26

Earlier quoted context omitted.

Just think of the parenthesis as loving warm homoiconic hugs.

Hehe, when teaching my 8yr-old programming (in Python) I call (function call) parenthesis a hug to explain that a function "hugs" all arguments to it. She seems to get that :).

This is a fantastic analogy, thank you for sharing! I found myself really struggling to communicate how a function's arguments got passed to it to my daughter and I'm going to try this the next time I need to explain it.

Re: Why I Switched from Python to Clojure (2016)

#27

I don't have a horse in this race but I find it interesting that in my career I've seen a lot of bad code but the worst clusterfucks I've met where all in Clojure while the community seems to be chock full of purists and in general people that takes craftmanship seriously at least at face value. ¯\_(ツ)_/¯

I work with clojure, and love it, but believe the problem is caused by java or equivalent paradigms applied to clojure.

The high probability that clojure was someone's first functional language could also contribute to the problem.

Your thoughts?

Re: Why I Switched from Python to Clojure (2016)

#28
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

> I just cannot work with it. Can't or won't? I'm not being facetious, here. I just can't imagine any reason one _couldn't_ work with it, once the syntax is learnt. There's nothing about lisp-like syntax that's inherently hard to learn. Why is lisp special?

Not only is it not inherently hard to learn, it's arguably one of the easiest syntaxes to learn. ( fn-name param1 param2 ... ) is the syntax.

Once the brain grasps this, a whole layer of complexity just vanishes. Furthermore, not having to use punctuation between items is just heavenly. There's so much less noise compared to Python, and Python isn't even a particularly noisy language.

Re: Why I Switched from Python to Clojure (2016)

#29
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

I haven't got much experience with Lisp, but I can imagine that, similarly to Python's significant indentation, it's a shallow weirdness that can be overcome easily after a little while. In both cases a little help from the editor will probably be needed.

You will shoot yourself in the foot less often with Lisp parens than you might with Python whitespace. Most modern editors handle the closing parens anyway.

Plus, many editors without any plugins can jump between matching braces; so moving around the code is very quick compared to Python (unless you have a Python plugin that has block movement shortcuts).

Re: Why I Switched from Python to Clojure (2016)

#30
post #4

I have considered multiple times switching from Python to other alternatives. However, I instantly discard any language with a Lisp-like syntax. I just cannot work with it. Being a Haskell hobbyist, I would like Python to be statically type and have better support for pure functional programming, but Python has the libraries that I need.

I've programmed for 10 years in Clojure and have many regrets, but I've grown to just accept that Lisp syntax is correct. On day one you need to understand one thing. Years later, you need to understand one thing. And sure, in Clojure they happen to use three types of brackets for brevity but even that's optional. But other languages have dozens if not hundreds of little syntactical edge cases. I personally find that inconsistent mess repulsive.
Post reply on HN