I suspect only Roger can elucidate this.

   x=: 1e3 [EMAIL PROTECTED] 1e4
   y=: 1e3 [EMAIL PROTECTED] 1e4
   f =: [:
   $ x (f +/ >) y

Interesting.  Why wasn't f executed, giving a domain error?
Experimentation reveals that (f +/ >) above uses the fast
code for ([: +/ >), so somehow the initial execution of the
hook looked at the value of f, even though only its name is
supposed to be available.

   f =: ff
   ff =: [:
   $ x (f +/ >) y
|domain error: ff
|   $x    (f+/>)y

Apparently the look goes down only one level.  Is this so
someone can assign   cap =: [:   and use it?  But it violates
the normal rules.  With f as defined above, I can write

   f =: ff
   ff =: [:
   s =: 4 : 0
f =: +
x > y
)
   $ x (f +/ s) y
1000 1000

which is correct: executing s modified the value of f, and the
modified value was used, avoiding the domain error.  But if
f is defined as [:, the modified value is not used:

   f =: [:
   $ x (f +/ s) y

See?  It executed as if f were [:

   $ x (f +/ s) y
1000 1000

Second time through, it uses the changed f.

It looks like f in (f g h) is inspected to see if it is [:, and
if it is, special steps are taken.  If this is so, it should
be documented.  But it seems a kludge to me, and I think the
special case should be removed (I have an interest in this, because
whether you document it or not, I have my book to think about).

If someone wants cap, let 'em write [: .

Henry Rich

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

Reply via email to