Live data from Hacker News

Why I Switched from Python to Clojure (2016)

bradcypert.com

191–200 of 200 posts

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

#191
post #90

Earlier quoted context omitted.

Tasteful macros can alleviate this, and Clojure's std lib has a few which are just delightful. The following does exactly what you'd expect, and there are even cooler ones like `some->` or `as->`. (->> some-nums (map square-root) (filter even?) set count) This is what lisp buys you, dead simple rules for syntax, with the option to add syntax with macros. If you made a mistake in syntax design, deprecate the lib and m…

And then you use a threading macro to assemble a middleware stack, only to find out that the middleware is applied in reverse order of what's listed as an inbound request comes in... (The outermost middleware being listed last in a threading form). There's a reason for it, for sure, but it's surely a part of the learning curve.

Yep, it's always possible to have a mismatch in assumptions. That one definitely bit me as well. What's important is that the learning curve is not due to arbitrary rules, it's a faithful application of the logic of the macro.

Remember that what is being passed through the threading macro is not the request, but the handler function itself. Each middleware takes the old handler, wraps itself over it to do things before and after the old handler. The threading macro is not a representation of the path your request will take, it is a way to build up a chained function that represents your final handler, which will then receive the request. Suddenly the ordering makes perfect sense :P

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

#192
post #129

Earlier quoted context omitted.

For someone familiar with HTML/XML, so any developer in the last 30 years, yes it is. Your point being? I like the ideas behind clojure, I really do. I even wrote a non-trivial personal project with it. However, coming back to that code after two months was basically like the plot of Memento. I ended up rewriting it in JavaScript instead.

Why rewriting it in js help with maintenance? This is not a snarky question, I'm genuinely curious since I personally have no problem coming back to old clojure code.

I can read the JavaScript I wrote months or years ago with very little effort. The language is fairly trivial, and the big gotchas have been mostly addressed by es6 and avoiding type coercion. I have limited time to dick around on personal projects and I mostly wrote Python and JS for a living, so having a familiar syntax means the difference between spending my time building cool stuff versus spending my time trying to remember how to read paren soup.

The other factors are cultural - so much of the clojure ecosystem is badly documented, or not at all. Sure, I can go and read your code to figure out what it does. But that comes back to the limited time argument, unless I'm paid for it, I'd rather write stuff in a language with a culture of proper documentation. For a recent example that does an outstanding job, see Elixir.

Finally, the ecosystem just feels... abandoned? Like walking through a ghost town. A lot of things on GitHub look incredible, but if there's no commits in the past 3 years I'm not inclined to invest time in it. I know the common argument about them being finished, and I don't buy it - non-trivial code rarely is.

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

#193
post #129

Earlier quoted context omitted.

For someone familiar with HTML/XML, so any developer in the last 30 years, yes it is. Your point being? I like the ideas behind clojure, I really do. I even wrote a non-trivial personal project with it. However, coming back to that code after two months was basically like the plot of Memento. I ended up rewriting it in JavaScript instead.

Almost anything (if not all) requires one to put in years of practice before one is adept. "a" non-trivial "personal" project probably won't cut it. Comparing that to your 30 years practice of XML is not at all useful.

I didn't say anywhere I have 30 years of experience with XML. What I said is, EVERYONE is familiar with the syntax. JSX is especially suited for expressing HTML because it is, in fact, almost HTML.

As to your other point - maybe. I'm not seeing anywhere near enough potential payoff to invest years into it, though. Also, I'd argue that makes it a terribly impractical language if you're interested in getting work done.

To clarify, I don't agree one needs years to become competent in clojure. But if one did, that just makes it a worse value proposition.

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

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

When comparing programming languages / tech stacks, I am also more interested in the full picture (libraries, complexity, performance) than just differences in syntactic sugar. I use https://github.com/gengstrand/clojure-news-feed as a test bed for such evaluations. There, you will find almost feature identical microservices in clojure using ring with the jetty adaptor and python 3 on flask. The clojure service was i…

I wouldn't say your Python example is comparable to the Clojure code. I'd describe it as "writing java in .py files", actually. No one is forcing you to write classes for everything in Python, having one class per file, and insisting to deserialize everything into classes. Simple functions and native data structures work just as well as in Clojure, and you'd end up with similar code as a result.

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

#195
post #148

Earlier quoted context omitted.

> where just R and Python don't really work. From the Spark website: "Write applications quickly in Java, Scala, Python, R, and SQL".

Thats not really how it works. You can write spark code in all those languages, but it's still spark code, running on spark execution engine. When you do stuff, it's on spark dataframes, not on R or Python dataframes. There's limited interaction with pandas but that's about it - you don't get R statistical algoritms for example.

(I just realised that my previous comment may have come out as rude, I'm sorry for that. I was typing in a hurry and it came out a bit dry).

Yes I agree with your points, what I was trying to convey in my comment is that, since Spark is not a programming language, I think that comparing it to Python or R is a bit of an apples to oranges comparison. The other point that I was trying to make is that both of those languages could be described as first-class citizens within the Spark ecosystem.

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

#196
post #193

Earlier quoted context omitted.

Almost anything (if not all) requires one to put in years of practice before one is adept. "a" non-trivial "personal" project probably won't cut it. Comparing that to your 30 years practice of XML is not at all useful.

I didn't say anywhere I have 30 years of experience with XML. What I said is, EVERYONE is familiar with the syntax. JSX is especially suited for expressing HTML because it is, in fact, almost HTML. As to your other point - maybe. I'm not seeing anywhere near enough potential payoff to invest years into it, though. Also, I'd argue that makes it a terribly impractical language if you're interested in getting work done.…

I'd rather work with Clojure than the monstrosity we make with our 30 years of experience.

Sure you can get things done and ignore the maintenance horror later.

Anyways, in the 30 years we at least steadily transfer features from Lisp.

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

#197

Earlier quoted context omitted.

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

Just about every innovative idea from Lisp, and there were quite a few of them, has been incorporated into modern programming languages. Except for sexpr syntax. Draw your own conclusions.

> Draw your own conclusions

My conclusion is that those languages which incorporate S-exps become identified as some kind of Lisp. This is the case even when it's a misidentification; i.e. little else is there of any Lisp "DNA" other than the parentheses.

Or else, those languages become identified as something that is not modern.

Thus, no modern, non-Lisp language has S-exps.

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

#198

Earlier quoted context omitted.

That the results didn't match the values. Disconnect happened for reasons I didn't fully understand. On a second observation I must have touched a VERY raw nerve given the huffy reactions.

Let me break it down. >I don't have a horse in this race but This is like someone saying I'm not racist but... After which they tell you why they really hate black people. You clearly do have an opinion your statement is a plea for imaginary objectivity. You follow it up by elevating anecdote to analysis without the work required for real insight. The crack about at least on its face is just designed to offend. The s…

I admire your restraint, you stopped short of calling me a nazi at least.

Again, you're completely missing the point: I don't have to "prove" anything to you. I don't even code anymore for that matter, and I can't give two shits if you prefer to write Clojure, Typescript or whatever rocks your boat, that's something that matters to you and not to me.

I simply observed that for a community that spends so much time talking about craftmanship and clean code, the worst messes I witnessed were all Clojure codebases and that's it. If you feel attacked... that's your own insecurity speaking.

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

#199

Earlier quoted context omitted.

Let me break it down. >I don't have a horse in this race but This is like someone saying I'm not racist but... After which they tell you why they really hate black people. You clearly do have an opinion your statement is a plea for imaginary objectivity. You follow it up by elevating anecdote to analysis without the work required for real insight. The crack about at least on its face is just designed to offend. The s…

I admire your restraint, you stopped short of calling me a nazi at least. Again, you're completely missing the point: I don't have to "prove" anything to you. I don't even code anymore for that matter, and I can't give two shits if you prefer to write Clojure, Typescript or whatever rocks your boat, that's something that matters to you and not to me. I simply observed that for a community that spends so much time tal…

You don't have to prove anything but if you do have a negative or positive opinion to share optimally your original comment would indicate that you are willing and able to discuss the matter.

Making a drive by comment and the copping out isn't much of a contribution to the conversation.

Furthermore look at this comment.

> I admire your restraint, you stopped short of calling me a nazi at least.

Some time in your life you should try actually try being an asshole instead of playing one on tv. It would be more honest and satisfying and people that aren't thin skinned can take a little civil disagreement.

All things suck to some degree. You might have an interesting perspective to share on situations where clojure sucks but you wouldn't know it because you are happy to stir up discussion but disinterested in any actual substantial disagreement. Guess that is done then.

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

#200

Earlier quoted context omitted.

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?

https://kotlinlang.org/docs/reference/java-to-kotlin-interop...

https://kotlinlang.org/docs/reference/java-interop.html

https://developer.android.com/kotlin/interop

Post reply on HN