RM=Raul Miller, RH=Roger Hui, DB=me
RM> what's a good idiom to extend cells of
RM> x and/or y with fills, such that their
RM> shapes conform?
X =: i.10 2 3
Y =: i.4 5 2 4
r =: 0>.(#$X)-1
Z =. (}.$ X) {."r Y
X i. Z
10 10 10 10 10
10 10 10 10 10
10 10 10 10 10
10 10 10 10 10
Of course, you do not want to use this idiom as the code backing the proposed
change. That would lead to false positives (non #x atoms).
RH> I propose to change this to return #x for each
RH> rank r cell.
My initial gut reaction here was "no", but I could not articulate why. My
reticence stems more from implicit uses of i. than explicit.
If I use i. explicitly on arguments that do no agree, it doesn't matter to me
whether I get an error or an array of #x ; neither one is useful and they
would both occur during code development, which would lead me to investigate
and fix the problem.
I'm more worried about other primitives that use i. family code under the
covers. Though, as I said, I cannot devise an example where the the proposal
leads to a change for the worse.
And, when it comes to J, I trust Roger more than I trust my gut.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm