3 ms·
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 s
by rak1507 3y ago
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 https://www.jsoftware.com/papers/tot.htm
[2] https://news.ycombinator.com/item?id=27223086 https://news.ycombinator.com/item?id=27223086