3 ms·
I'm not familiar with either J or NumPy. I have no idea what the first line does in either of these examples. And the fact that NumPy uses an English word, ax
by kwhitefoot 6y ago
I'm not familiar with either J or NumPy.
I have no idea what the first line does in either of these examples. And the fact that NumPy uses an English word, axis, as a named argument means nothing at all to me
I think it is an exaggeration to say that the NumPy is any clearer to the uninitiated than the J. Once one has learnt J then surely it is as easy to read as the NumPy? The NumPy just looks easier because the syntax is more familiar.
- isoprophlex 6y agoFor one, the numpy versions use method calls with human readable names. I prefer ergonomics and having my colleagues grok what a line does: eg. 'reshape' calls will change the shape of your array. Bless you if you're in an environment where you can always pick the tools that work for you. But I'm never going to convince my (java, scala, python, R) adept colleagues that they need J in their life. Here lie my gripes with the linked article, it's just not such a good sales pitch.
- dTal 6y ago>I'm not familiar with either J or NumPy... I have no idea what the first line does In that case, you owe it to yourself as a programmer to go and get familiar with some APL-isms, for they are for numerical arrays what regexes are for strings and are rapidly becoming ubiquitous[0]. I wowed my boss once because I was able to mold an array into the shape we needed it in a few seconds... in Mathematica, a language I had never used before that moment, because I knew what to search the documentation for. It doesn't matter where you get it from, just pick a language with APL-isms - I recommend NumPy if you like popular stuff, and Q'Nial if you like esolangs - and work through Project Euler without writing any loops. It'll be fun! And of course, if you're unfamiliar with the core concepts, then naturally both syntaxes will look equally opaque. That doesn't mean they are though. Once you understand what they are trying to express, then you will be in a better position to judge. [0] In Julia: b = reshape(1:12,(3,4)) cumsum(b,dims=2) #Julia is 1-indexed