I learned something new in the last 90 minutes, this is a small
summary.
(I always tell people that one never stops learning J. Nevertheless
I'm still always a bit surprised when this holds for me, too. :-)
It dawns on me that I just re-answered the "when is v f. not v?" FAQ
which I admittedly always skipped so far.
Roger Hui wrote:
> a. The dictionary entry for m~ should not say that its rank is _ .
I always felt that _ (or rather: _ _ _) was quite an appropriate choice
for the rank of m~ verbs. My reasoning: the entire purpose of this
construct is dynamic/deferred name evaluation, and _ _ _ is the best
a priori rank fixing which is meaningful here.
> The ranks should be mv lv rv, which are the ranks of the named verb.
My first reaction on this was "No way!" Becase, what does that mean for:
foo = +:
v =. 'foo'~
v b. 0 NB. now according to the suggested mv lv rv ruling:
0 0 0
foo =. |.
v b. 0
? ? ?
My question being how much we want to mess with the "intrinsic" rank
of a verb.
However, before I haggle about the m~ rank, I should probably
first try decide for myself how "intrinsic" or "sticky" I want
to settle the following, a bit more essential question:
Tests with J4/6/7 all show this behaviour:
foo =. +:
v =. <@foo
v b. 0
0 0 0
v i. 3
+-+-+-+
|0|2|4|
+-+-+-+
NB. So far, so good, nothing special here.
NB. Now let us redfine foo and see what happens:
foo =. <
v b. 0
0 0 0
v i. 3
+---+---+---+
|+-+|+-+|+-+|
||0|||1|||2||
|+-+|+-+|+-+|
+---+---+---+
v
<@foo
Oh. I'm probably the last one to notice this. Let's call this
behaviour
"Named verbs have sticky rank."
While I can understand this actual behaviour, I am not sure whether
I should like it. I certainly don't like that this experiment can
be continued with:
v f. 1 2 3 NB. *not* the same as v 1 2 3:
+-------+
|+-----+|
||1 2 3||
|+-----+|
+-------+
Then again: fixing 'm'~ at rank mv ml mr early on is just consistent
with v having sticky rank.
Question to everybody:
If I were to re-implement J and would "auto-correct"/"recompile"
derived definitions, would you...
[ ] like it
[ ] hate it because it's changing past behaviour
[ ] consider it conforming to the Dictionary
[ ] cry foul because you think The Dictionary mandates "sticky rank"
[ ] don't give a damn either way
Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm