7 ms·
NumPy another Iverson Ghost (2018)
- s1t5 6y agoI read the post and still have no idea what point it's trying to convey apart from a general sense of smugness. > At the end of my programming day, I want to look on something that is beautiful. I don’t particularly care about how useful a chunk of code is or how much money it might make, or what silly little business problem it solves. If the damn code is ugly I don’t want to see it. I can't relate to this at all.
- nerdponx 6y agoSeems on-brand for someone whose website subtitle is "Trust is for imbeciles."
- scottlocklin 6y agoThe author of this, who I know a little, maintains what I think is one of the most important pieces of code nobody ever talks about; JOD[0]. It's an idea that I guess used to be common in the APL world: code database. I've used it a little, and plan on using it more and hopefully exposing it to popular acclaim. At base, you can think of it as a fairly different way of dealing with namespaces in a word-based language (J also has very powerful namespaces, but I assume the ideas behind JOD predate those), but it ends up being more powerful than that. He's also right about Numpy. FWIIW Wes McKinney was also inspired by J when he wrote Pandas and Arrow. [0] https://bakerjd99.files.wordpress.com/2020/03/jod.pdf https://bakerjd99.files.wordpress.com/2020/03/jod.pdf
- lordgrenville 6y ago> FWIIW Wes McKinney was also inspired by J when he wrote Pandas and Arrow. Do you have a source for this? I always assumed it was based off of R, just from the syntax.
- scottlocklin 6y agoSource: I know Wes and talked to him about it a number of times online and IRL (he was also pretty good pals with Kevin Lawler -we all lived in the Bay Area at the same time: none of us do atm, which is anecdata for the perpetual "fleeing bay area" thread). I originally got to know him as I was thinking of participating in the startup he had done that eventually got bought by cloudflare as he was explicitly hiring J dudes. Anyway, ask him; he'll tell you! data.tables in R has some strong resemblances to J notation as well; might be one of those inevitable things (Greenspun's 10th applied to array programming/APL), but I never talked to the author.
- bakerjd99 6y agoScott, Thanks for your kind words "The author of this, who I know a little, maintains what I think is one of the most important pieces of code nobody ever talks about; JOD[0]." If I was selling JOD, I would seek to use your quote in promotional material. However, I am not selling JOD; it's open source for all to use - see: https://github.com/bakerjd99/jod https://github.com/bakerjd99/jod It's even going on ice in the Arctic Code Vault. https://analyzethedatanotthedrivel.org/2020/08/17/jod-goes-into-the-arctic-code-vault/ https://analyzethedatanotthedrivel.org/2020/08/17/jod-goes-i... Thanks again.
- robomartin 6y agoThis is the APL version. I still have one of the original printed books dating back to the early 80's. https://aplwiki.com/wiki/FinnAPL_idiom_library https://aplwiki.com/wiki/FinnAPL_idiom_library
- imglorp 6y agoI'm curious why APL hasn't met all the AI/ML work with Tensors. It seems like a well suited marriage at first glance.
- skruger 6y agoSeveral papers available on using APL for ML, e.g. https://dl.acm.org/doi/pdf/10.1145/3315454.3329960 https://dl.acm.org/doi/pdf/10.1145/3315454.3329960
- vmchale 6y agoSo far the GPU backends are not all that.
- jpf0 6y agoI lead a company that has a large portfolio of AI/ML/optimization algorithms in J (Monument). Happy to answer questions.
- tosh 6y agodoes J have support for using GPUs? or can you share a bit about how you use J? I guess there are also some ways where GPU support is not as important (different architectures or leaning more on transfer learning?). can you share a bit about how you came to use J?
- jpf0 6y agoWe use J in all ML and data handling functions, everything except UI and viz. We primarily focus on algorithms that require rapid sequential iteration rather than parallelism. However: 1) we run an enhanced version of J that is implicitly parallel on CPUs, and 2) it is possible to call GPUs (both CUDA and openCL) through J (e.g. j-fire). We do not call GPUs or other accelerators currently, though we may do so in the future. Our goal with Monument is to create an Excel-like substitute for ML / AI. In comparing across languages, we selected J as "the right level of abstraction" for ML / AI because we wanted to write fast-running code, quickly. J runs on virtually all CPUs and OSs, and it is highly tuned for minimized cache misses and mis-predicted branches. It is well-documented, well-supported, and the community is highly supportive. Like Python, J makes it possible to run highly-optimized code without a great deal of boilerplate in an interactive development environment. Unlike Python, J is composed of reusable functions that readily express math. Our dev productivity is extremely high, and often we're able to engage with mathematicians who have little or no programming background. Our team comprises polyglot programmers, and I strongly avoid "the language wars," but overall we have found J to be well-suited to our needs.
- stdbrouw 6y agoI don't really see the resemblance between J and NumPy the author claims is so obvious. I mean, yeah, some of the snippets look similar but they do the exact same basic array manipulations, what do you expect?
- wodenokoto 6y agoHe expects all array manipulation to originate from APL
- michaericalribo 6y agoI think the J examples at the bottom illustrate perfectly _why_ it’s preferable to force this type of array syntax into a language like Python, rather than jumping ship for APL: The J is inscrutable! But the Python is intuitive. Analytics code I’m writing for work needs to not only operate on arrays, but also get the hell out of the way! Understanding and communicating numerical routines is hard enough without obfuscating basic procedures.
- vmchale 6y ago> The J is inscrutable It's understandable after a time, like all else.
- eesmith 6y agoThere are common arguments the other way. Do you remember how hard it was to memorize, or at least become familiar with, all of the API function names? Or with various language syntax, like generator comprehensions and decorators? Over the years, and with practice, it's much easier to remember the details. The same is true with the terse notations of the APL-like languages - once you learn them, they are not hard. And there aren't all that many symbols. Some of what you see are composeable combinations of basic symbols. Or, think of shorthand, which takes time to learn, but makes it possible to, for example, take dictation at a speed that longhand cannot manage. While I don't think most programming is limited by typing speed, I do think that for some sorts of exploratory research it is. For a related essay, see https://steve-yegge.blogspot.com/2008/09/programmings-dirtiest-little-secret.html https://steve-yegge.blogspot.com/2008/09/programmings-dirtie... . Finally, APL fans will (correctly, IMO) point out that (in)visibility is part of what makes something hard. That is, code which fits on the screen is easier to read than code which flows over several pages. Thus, the effort of learning a more concise language may pay off in the long-run. (Note that I don't work with numeric arrays and have little experience even with NumPy - I've just read about this debate often.)
- agumonkey 6y agooh man if you find that inscrutable, I suggest not to watch Aaron Hsu videos on the matter :) I'm not for overcryptic nor making people suffer.. I simply believe that people are underestimating how short syntax + repl + operators can be memorized and enjoyable.
- isoprophlex 6y agoSo theres numpy: > b = np.arange(12).reshape(3,4) > b.cumsum(axis=1) or, would you prefer the following: > b =. 3 4 $ i. 12 > +/\"0 1 b Yeah, no thanks ...
- jhayward 6y agoWhy would you pick the most trivial example, rather than something that shows the high-level expressiveness of J et. al.?
- irishsultan 6y agoIt's one of the most advanced examples on the linked page, definitely not the "most trivial".
- jhayward 6y agoIf the limit of one's experience with arrays is summing a column or row of numbers, perhaps one is not the target audience for an array programming language. Summing along an index is about the most trivial application of array processing imaginable.
- svantana 6y agoHonest question: couldn't you get equally expressive using english language keywords instead of cryptic characters?
- rscho 6y agoThere's a library in J for doing exactly that. Few people use it.
- yiyus 6y agoNot at all. Try to write equations using English words instead of "cryptic characters" and think which is more expressive, eg: a) a*(b+c) = a*b + a*c b) equal(multiply(a, add(b, c)), add(multiply(a, b), multiply(a, c)))
- mlthoughts2018 6y agoI would encourage the author to watch the talk “You Got What You Got” by James Powell, on restricted computation domains. https://m.youtube.com/watch?v=wbYG9KTxwdE https://m.youtube.com/watch?v=wbYG9KTxwdE
- bargle0 6y agoWhy do so many APL articles show up on HN?