Live data from Hacker News

Why I Switched from Python to Clojure (2016)

bradcypert.com

111–120 of 200 posts

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

#111
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…

I used to hear the exact thing about Python, incidentally. People would complain about how horrible significant whitespace is and how it causes all these problems, yet everyone I spoke to that used Python said the same thing: that it fades away into the background very quickly and ceases to be an issue. This was also my exact experience with significant whitespace.

Lisp parentheses are the exact same way, in my experience. You hate them until you spend a few weeks writing a Lisp and then they just fade into the background, never to bother you again. Then once you learn paredit, it becomes painful to use other languages again! (And now with parinfer, I think about them even less still) Incidentally, in my experience, Clojure typically has the same amount of parentheses as typical OO languages, in some cases fewer, its just that the opening paren is moved one word to the left.

Also, to anybody new to Lisp: try an editor with rainbow parentheses.

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

#112
post #107

Earlier quoted context omitted.

I don’t agree that Clojure is a new and shiny thing.

Clojure itself is not a new, shiny thing. What's new and shiny is "I switched from Python to a language that will make me write more LOC."

LOL. Clojure is actually one of languages with a terse and minimal syntax, pragmatisized to its core.

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

#113

My impression of Python is that it's a Fisher Price Little Tikes coupe with a few GE90 jet turbine hardpoints mounted on it. It's a very simple language. Literally when things get made to be complex Guido says do it the simple way, because when unbreakable things break it's just that much harder to fix. This makes it very easy to debug, very easy to fix/patch, very easy to onboard new/junior developers in, and very e…

Are you implying Clojure is not simple? Have you ever watched Rich Hickey's "Simple made easy" talk? If you haven't, I highly recommend it. Disclaimer: It's not about Clojure.

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

#114
post #103

"Why I Switched from Python to [Shiny Newer Language]" seems to be the thing on HN this week.

The really hilarious part about this one is that it’s from 2016, and the author seem to have since switched from Clojure to Kotlin.

I think it’s still interesting to read about people switching. I mean, I’ll never understand why people prefer functional languages to OOP. I think it’s just so much easier to maintain OOP in the long run, and you can frankly build most of the advantages of functional languages within OOP if you need to. But then you read an article like this and you get a reminder that freedom can lead to some really horrible stuff and that is especially true for Python in general.

I don’t see this as “we should all switch from Python” sort of thing, but rather a “don’t do these things with Python”.

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

#115
post #57
post #29

Earlier quoted context omitted.

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

> You will shoot yourself in the foot less often with Lisp parens than you might with Python whitespace. I'm not letting that stand ;-) In my experience Python's whitespace generally removes sources of scope/block errors compared to parenthesis and curly-based languages > unless you have a Python plugin that has block movement shortcuts Not sure what this means. The only support I need in an editor is the ability to…

> It's visually obvious when code is correctly indented

Not always, in my experience. I’ve lost many hours to debugging only to realise some piece of code was misindented. It doesn’t happen often and usually when code is being moved around, but when it does, its been painful.

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

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

Yeah, there are people who simply can't read Lisp syntax. Where I see structure and beauty, they see "murder of parens" (or whatever demeaning collective noun they use to describe it). I call them dyslisplexics.

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

#117
post #94

It's interesting that the very things that attracted the author to Clojure was what kept me from moving to it from Python. I enjoyed the syntax. Loved the immutability. However, I wasn't able to understand the structure of program data at a glance even when reading my own code. The reliance on lists and maps everywhere meant that the structure of data was encoded in the code of the functions that created it and somet…

The fundamental problem with S-expressions is that they are intended for (1950s) machine readability and human ergonomics takes a back seat.

sure, because Sure, because this (taken from React's JSX example page):

    
      Scores
      
    ;
    
is more readable than this:

    [dashboard-unit {:data-index 2}
      [:h1 "Scores"]
      [scoreboard {:class-name "results"
                   :scores game-scores]]
                   
Please tell me more about Lisp readability.

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

#118

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.

Kotlin simply is an attempt to fix Scala problems, which in itself is an attempt to fix Java problems. Clojure by design - simply doesn't have those problems.

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

#119
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…

I agree. Within the data science community I often see the question of "R versus Python" and it always makes me think of the Old El Paso commercial: ¿por qué no los dos? I know choosing the right tools for the task can have serious long-term implications on the project, team, or organization level, but individually I get the impression that people worry too much about which language is best when, in reality, many of…

For us, the answer to "R vs Python" is "Spark" since eventually you get to dara sizes where just R and Python don't really work.

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

#120

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.

It sounds like he is doing Android, where indeed Kotlin is strong, and an officially supported language too.
Post reply on HN