On Wed, 15 Jun 2022, Marshall Lochbaum wrote:

I do agree that using nesting for homogeneous shapes is inelegant. What they're doing in this case is like putting a marker in the shape, which could be written 2 3|3 4 in the boxed array A *&.> < B. It's weird that the way to do this is to switch over to an inhomogeneous representation. But it works.

Exactly. Wouldn't it make so much more sense to project that marker at need by arguing it to a function or operator than forcing it onto the data itself?


Maybe I've misunderstood, but your comments about nesting give me the impression you think BQN's further from J than it is. Most BQN primitives work on items ("major cells") and don't care whether the argument is nested.

I expected no less. While it has not seemed worthwhile to study bqn, I generally think of it as being about as close to j as dyalog apl sans a couple of the most obvious mistakes would be. Do I miss the mark?


So dyadic , translates to ∾ and I believe the only difference is that BQN doesn't try to extend an argument with rank more than 1 smaller than the other

Suppose x is an array of rank 1, and y is any object. What is the f such that x f y has rank 1 and length one greater than x; its leading elements are those of x, and the final element is y (and the obvious extension to higher-rank x)? Aside from ∾, you need not only an f, but also a flipped version, as well as a function which takes two objects and produces a rank-1 array whose sole two elements are those objects. (I guess this last is the stranding metanotation; as it is metanotation, it too cannot compose, and so contortions like {𝕨‿𝕩} are necessary.)


Similarly, J's { and BQN's ⊏ are identical when the left argument is an array of numbers. BQN doesn't even have a version of APL's Split, and uses < with rank like J.

Oh--I skimmed the documentation, and saw βŠ‘ before I saw ⊏. Regardless, I do not think the result can be consistent. Trying both:

   β‰’0βŠ‘(2β€Ώ3)β€Ώ4
⟨ 2 ⟩
   β‰’0⊏(2β€Ώ3)β€Ώ4
⟨⟩

I do not know what is more bizarre: for an array to be automatically demoted because it did not have the right rank (as apl does with reductions), or for the shape of the result of an indexing operation not to be predictable from the value of the index and the shape of the array being indexed.


It seems Bracha's concern about a "shadow world" is that it's lacking capabilities relative to the "real thing"? I don't think this ends up being the case with nested arrays because they're still arrays, so that functions like Rotate or Grade can be the same. BQN has all the array manipulation of APL and nearly all of K with a fairly small amount of duplication: pair functions ≍ versus β‹ˆ, mapping ˘ versus Β¨, folds Β΄ versus ˝, and I guess you could argue reshape β₯Š versus splitting with βŠ” (and transpose ⍉ is missing its analogue, K's flip).

Six isn't enough? (Actually, j has three: L: S: L.; I don't think they were worthwhile.)

Anyway, transpose is important, because it is one of the few really multidimensional operations. Take it to its logical conclusion. What if I have a matrix of vectors--that is a three-'axis' structure--and I would like to exchange the first 'axis' with the third?

---

I would add--I would expect many of these arguments have been had many times over before either of us was born :)

 -E

On Wed, Jun 15, 2022 at 04:49:50PM -0700, Elijah Stone wrote:
On Wed, 15 Jun 2022, Marshall Lochbaum wrote:

> my opposition to J's flat array model (I think it's almost always worse
> than BQN's based model) is different from my stance on flat arrays BQN
> can also represent and optimize these, although there's no name for the
> category; they'd be called arrays of numbers or arrays of characters

I was speaking only of semantics, not implementation details.


> And of course there can be huge advantages to working with them, but I
> think it's madness to use this as grounds to dismiss a solution that's
> much shorter and easier to read

I was not dismissing your solution, nor saying that the present one was
better.  I was saying that I find the use of nested structures inelegant (as
well as unnecessary in this case, since the data are completely
rectangular), and that the deficiency in j is only a lack of a primitive for
managing these multi-dimensional data effectively.  It is a general problem:
it is difficult to manipulate high-dimensional data.

Regarding nests:

1. They provide inconsistent results: what relationship has the shape of x{y
to the shapes of x and y?  How can dyad , possibly behave consistently?

2. They are a shadow world (cf
https://gbracha.blogspot.com/2014/09/a-domain-of-shadows.html) of
organisation.  Monads 'split' and 'mix' in apl illustrate this; it is not
possible to compose contiguous organisation (adding dimensions to an array)
with noncontiguous organisation (adding nested structure to an array).  K is
consistent because it only has nested organisation; bqn has both.  J
explicitly places nested organisation in a box, segregated from the rest of
the languages, which composes and is coherent.


> more in keeping with other array principles: that blind reshape ($,) on
> the transposed array is something I try hard to avoid.

Yes; see again the baker paper.

 -E
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to