Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The original article wasn't about the economics of different languages. It was about not using "clever" code. That J code isn't "clever", it's a very straightforward implementation of the problem, just in a language that is unfamiliar to most people. If someone wants to write an article saying no one should ever use J, fine, but that's a pretty separate article.

You said the moving average in particular was "obtuse". How? It's more verbose than it could be, to make it more readable/obvious. Like I asked, what would you do? Whenever people say something is bad, if they can't provide either a good reason or an alternative, it makes me inclined to think that it is simply a kneejerk reaction to unfamiliarity.



If you code that same thing in js, java, c++, python or rust they all look similar. If you can achieve the same performance in a language understandable by more people you will be better off.

Another example is, Russian is much more expressive than English due to the more advanced grammar. That said if you want to express yourself to your American peers and they don't speak Russian you don't write in Russian. If you are all Russian sure.

We use kdb/q in our firm but I would rather not and will be trying to migrate away from it in the future. It is good but bigger picture more trouble than it is worth. At least our code is formatted and not all one liners like Morgan Stanley.


Whether or not someone should use J vs another language is an interesting, but entirely separate question. The original post was about rewriting things in the same language to be more 'readable', not to suggest everyone who doesn't use one of the imperative languages you mentioned should just rewrite their entire codebase, which would obviously be an unrealistic suggestion. As I said in my other comment, I have an issue with this (or at least the examples they gave), because the J code is not unreadable to J programmers.

Like you say, if everyone speaks Russian, communicating in Russian can have benefits. The same thing is true with J, or k, or any of these more obscure languages. Saying that your code is "formatted" and not "one-liners" to me suggests that you haven't seen these benefits yet, and I'd suggest reading Iverson's Notation as a Tool of Thought[1] or some of the very informative HN comments [2] about how this style of code can be very useful and productive, and yes, readable.

You still haven't answered my original question, which was how the implementation of the moving average was "obtuse". The moving average code is (>:i.$n)%~+/\n. This seems pretty reasonable to me. As the cumulative sum is ascending, you can use /: instead of i.$, but that seems less obvious. I don't know what issue you could have with this code, other than it having slightly more punctuation than a mainstream language.

[1] https://www.jsoftware.com/papers/tot.htm

[2] https://news.ycombinator.com/item?id=27223086




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: