Live data from Hacker News

Why I Switched from Python to Clojure (2016)

bradcypert.com

41–50 of 200 posts

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

#41

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. ¯\_(ツ)_/¯

What a passive aggressive comment.

> At least at face value

Implying that in actually they are what a bunch of incompetent hacks?

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

#42
post #38
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.

Every person that I've talked to that seemed to have a strong negative opinion about parens never used it. They just think they won't like it but wouldn't take the minimal amount of time to give it a try with something like paredit. I was also in this camp for a long time until I figured I would give it a serious try instead of disparaging something I had not used. You might consider that creating and editing code wi…

For me the ability to edit code structurally (rather than in terms of plain text) in a uniform way is a great advantage of Lisp syntax.

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

#43
I can, and do, appreciate opinions on languages themselves. But my decision to continue using Python over Clojure is much less about the language's syntax and more about the available libraries. How do Clojure web frameworks compare to Django/Flask? What would I use instead of Pandas for data analysis? Are there keras-like deep learning tools?

Switching languages based on a comparison of idiosyncrasies between the two seems like moving to a new city based solely on the weather: a valid consideration, but nowhere near sufficient.

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

#44
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!

If you did a write-up or went into more detail about your experience, I'd read it.

Big fan of Python and am heavily invested in its ecosystem, but I currently prefer async programming in modern JavaScript compared to Python.

Did you make use of third-party async libraries?

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

#45

Earlier quoted context omitted.

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!

If you did a write-up or went into more detail about your experience, I'd read it. Big fan of Python and am heavily invested in its ecosystem, but I currently prefer async programming in modern JavaScript compared to Python. Did you make use of third-party async libraries?

I'm going to ask my boss to open source it and then do a write up.

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

#46
post #43

I can, and do, appreciate opinions on languages themselves. But my decision to continue using Python over Clojure is much less about the language's syntax and more about the available libraries. How do Clojure web frameworks compare to Django/Flask? What would I use instead of Pandas for data analysis? Are there keras-like deep learning tools? Switching languages based on a comparison of idiosyncrasies between the tw…

Clojure works on the JVM so you have native access to all of the Java ecosystem. With that in mind I'd say the libraries are actually better for Clojure with the exception of data analysis. I don't think there's a language out there that has as many data libraries as Python (like Pandas).

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

#47
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.

That's a shame. I use Haskell but wish it had paren syntax. I'd rather have strong types than sexps so I stick with Haskell.

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

#48
post #30

Earlier quoted context omitted.

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…

What are those regrets? ;)

Oh, so many things.

The parallelism isn't actually that powerful, and in 2019 there's very little to set it apart. The building blocks are great, e.g. immutability everywhere, but few of the built-in primitives are actually usable (hidden unconfigurable thread pools etc). Stack traces still regularly horrible. Libraries are regularly abandoned. ClojureScript integrating with npm etc is more stress than you'd like. Core development is haphazard and proudly so. Types are nice, and spec is still up in the air, and slow, and not widely implemented, and will probably be rewritten several more times before being abandoned. Hiring is harder than a dozen other languages.

All that said, there is still amazing stuff happening. I hold out some hope that Dragan's work might spark a bigger stats/ML community on top of Clojure, for example:

https://dragan.rocks/

Every day I can still write code and think "yay, that's cute", and be thankful for the dynamism and clarity it can enable. But I wouldn't recommend it to anybody, for anything really, and I feel sad realising that.

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

#49
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 instantly discard any language with a Lisp-like syntax. I just cannot work with it." I feel the opposite. I avoid any language without a Lisp-like syntax, since its absence is a serious handicap which unnecessarily complicates code and makes it less readable. I also much prefer the Lisp idiom of using meaningful function and variable names, vs the one-letter names and crypitic operators that are so common in Haske…

Bear in mind that often the reason Haskell code uses one-letter names (and this is possibly true for the other MLs) is that your types can be so generic that you can write useful functions without knowing what you're working on. In such situations, `x` is just as good as `thing`, as far as names are concerned.

As for the operators: they are a visual language. We do not speak our punctuation aloud in English, and we use small marks to guide the reader's eye. Often, Haskell operators as similar, and there is a definite pattern.

f $ x means "f applied to x"

f x means "map f over x"

In general, the around an operator lifts it to work over a structure. Similarly:

x & f means "f applied to x"

x f means "map f over x"

For the applicative operators like , star> and <star (where "star" should be an asterisk but I can never work out the formatting on this forum), the operators "point" at the values being retained. And so on.

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

#50
post #40

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. ¯\_(ツ)_/¯

"The worst injuries I've ever seen were in big factories with large, powerful tools -- not in home garages where people just use hammers and hand-saws." Powerful abstractions are... powerful. They're more difficult to use correctly, and take longer to learn. The conclusion shouldn't (always) be to avoid them entirely.

A good rule of thumb is the more powerful the language the stronger your justification needs to be for using it:

https://en.m.wikipedia.org/wiki/Rule_of_least_power

LISP is, of course, way more powerful than most languages so it is more susceptible to technical debt.

Post reply on HN