J Notation as a Tool of Thought
31–40 of 60 posts
Re: J Notation as a Tool of Thought
#32In K the error messages are far harder to understand than most languages, and you'd need either enough comments or many hours of experience with the language to understand what a piece of code does, due to its sheer expressiveness. Also, there's comparatively less documentation for when you're trying to do something practical. I can't imagine introducing J or K in an open source project will be helpful if other contributors have to catch up to my understanding of the language and need to internalize and remember which single-character symbols mean "print" or "iter." I imagine that at least a Python programmer could reasonably understand the gist of a similar Ruby program, merely due to the fact that "class" and "map" and "length" are sequences of characters that usually show up in both languages. Not so with K.
Still, I find the vastly different ways of doing things with K interesting to see, even if I will only use it personally.
Re: J Notation as a Tool of Thought
#33J and K remind me of the essay about the Lisp Curse[0], which mentions that the expressiveness of the language became a sort of Achilles heel in its culture. It talks about people writing their projects in Lisp and not expecting other people to adapt to their conventions or combine their efforts on one library, where every solution worked well enough initially - but only for one person, its author. In K the error mes…
Re: J Notation as a Tool of Thought
#34I agree with most of this article, except that - for me - grouping by table columns is a more intuitive and flexible way to control subset application than 'rank'. k9 is in development, but blending k7 and k9 we'd get something like: t: [[]sensor: 1 2 1 2 1 2 day: 1 1 2 2 1 1 reading: 1 2 3 4 5 6] 0 1 1 0 * select by sensor, day from t sensor day| ------ ---|---------------- 1 1 |[[]reading: 0 0] 1 2 |[[]reading: ,3]…
Re: J Notation as a Tool of Thought
#35J and K remind me of the essay about the Lisp Curse[0], which mentions that the expressiveness of the language became a sort of Achilles heel in its culture. It talks about people writing their projects in Lisp and not expecting other people to adapt to their conventions or combine their efforts on one library, where every solution worked well enough initially - but only for one person, its author. In K the error mes…
Re: J Notation as a Tool of Thought
#36Earlier quoted context omitted.
You've reproduced the most trivial example, which many languages make easy. I would be very interested to see another language with a rank operator, for instance. ------------------------------------------------------------------------ Challenge for you: rewrite a nontrivial program in one of those frameworks, with the following restrictions: - No iteration (including implicit iterations—map, filter; reduce is ok) -…
Rank Is actually implicitly done by numpy using a mechanism called broadcasting. For example: >>> np.array([10, 20, 30]) + np.array([[1,2,3], [4,5,6], [7,8,9]]) array([[11, 22, 33], [14, 25, 36], [17, 28, 39]]) Sieves exist in numpy, called masks: >>>np.array([10, 20, 30]) > 15 array([False, True, True]) Of course they can be operated on just like any other numpy array. Grades exist in numpy: >>>np.array([5,4,3,2,1])…
That's putting it mildly.
Re: J Notation as a Tool of Thought
#37J and K remind me of the essay about the Lisp Curse[0], which mentions that the expressiveness of the language became a sort of Achilles heel in its culture. It talks about people writing their projects in Lisp and not expecting other people to adapt to their conventions or combine their efforts on one library, where every solution worked well enough initially - but only for one person, its author. In K the error mes…
That is fine. Most people simply cannot drive a Formula-1 car, but it would be stupid to conclude that a F-1 is a cursed car and nobody should want to drive one. Similarly, a few languages can only be used by highly trained people who understand well how it works. Lisp, Forth, and J are in that category of tools that require highly trained people. In their hand, one of these languages can do fantastic things, in the…
Re: J Notation as a Tool of Thought
#38Earlier quoted context omitted.
Comparing numpy to J is like comparing a dirty rag to a designer suit. The examples you've listed are trivial; the power of J and other array languages cannot be appreciated from afar. The philosophy behind array languages runs much deeper than adding two arrays or transposing matrices.
Can you give an example of something that can be done in J that can't be done easily in numpy?
(>,{;~i:1) |. i.4 4
Try it online: https://tio.run/##y/r/PzU5I19Bw06n2rou08pQU6FGTyFTz0TB5P9/AA[0] https://www.youtube.com/watch?v=a9xAKttWgP4&t=5s
[1] https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NWJtjb...
Re: J Notation as a Tool of Thought
#39Earlier quoted context omitted.
Rank Is actually implicitly done by numpy using a mechanism called broadcasting. For example: >>> np.array([10, 20, 30]) + np.array([[1,2,3], [4,5,6], [7,8,9]]) array([[11, 22, 33], [14, 25, 36], [17, 28, 39]]) Sieves exist in numpy, called masks: >>>np.array([10, 20, 30]) > 15 array([False, True, True]) Of course they can be operated on just like any other numpy array. Grades exist in numpy: >>>np.array([5,4,3,2,1])…
> are a little more verbose That's putting it mildly.
Re: J Notation as a Tool of Thought
#40The article has the footnote > APL was the first language to use “monad” as a term. The popular FP meaning only appeared thirty years later. in its, to me odd, use of the word "monad". This is incorrect. The "popular FP meaning" arose because it's a very special case of the standard concept from mathematics [1]. The mathematical terminology harkens back to the 1950s, and thus predates APL. In Haskell, a monad is prec…
Does it? The earliest instances I can find are in Mac Lane's 1971 book or thereabouts; the older term was "triple". Wikipedia dates APL to 1966.
"Monad" has also seen nebulous use in philosophy at least since Leibniz.