On Fri, 05 Jun 2009, PackRat wrote:
> The very lengthy recent discussion in JChat concerning Don Watson's
> desires for what he considered simplification of J's syntax gave me a
> moment of enlightenment about [ and ] . (On the other hand, maybe you
> all might consider it a moment of *mis*-enlightenment!) And that "aha"
> moment was that "[" referred to the noun in the left "x position" with
> reference to the entire tacit verb expression and that "]" referred to
> the noun in the right "y position" with reference to the entire verb
> expression--in other words, in "x tacitverbexpression y", any "["
> within the tacit verb expression refers to the value of x and any "]"
> within the tacit verb expression refers to the value of y. I don't
> know if this understanding is correct, though.
I guess you have been mis-enlightenment. Firstly [ and ] are verb, in
that context DOJ said they will yield their noun argument. Nothing
has been said about tacit form or train. To be verbose, verb itself
can only see its immediate left or right noun arguments. It is the J
parser that do the magic of tacit form.
> Now here is where I need further enlightenment: if what I just said
> is true, then the Dictionary definition of "[" and "]" (left and
> right) seems to be wrong as it stands. (This ties in as well with
> Raul's t1 and t2 definitions above.)
>
> Taking the Dictionary definition exactly and literally, it would
> appear that in t1 everything to the left of the "]" should be thrown
> out and only the "]" and its rightward elements would be returned.
> In t2 everything to the right of the "[" (up to the parenthesis)
> should be thrown out and only the "[" and its leftward elements
> would be returned. Likewise, using the literal definition rather
> than the understanding I noted above, in a tacit expression "a [ b ]
> c" where a, b, and c represent sequences of J primitives, the
> Dictionary definition seems to say to throw out "a [ b", returning
> only the result of c. In a similar manner, in the tacit expression
> "a [ ( b ] c)", the Dictionary definition seems to say to throw out
> "(b ] c)"--which yields the result of c, returning only the result
> of a.
This is not how J works. Suppose a b c are verbs and you define a
train
f=: a [ b ] c
when J interpreter execute this sentence, it will parse it to a syntax
tree that is an internal representation of textual 'a [ b ] c' It
will not deduce that f=: a. Later when it evaulate x f y, it will
execute using the stack as described in DOJ
x (a [ b ] c) y
(x a y) [ x (b ] c) y NB. fork
(x a y) [ (x b y) ] (x c y) NB. another fork
(x a y) [ foo ] bar NB. foo and bar are noun
(x a y) [ bar NB. ] return right
(x a y) NB. [ return left
[ and ] have never seen the outside x and y. Furthermore verb b and c
will always be evaluated for the possibility that their side effect is
what you wanted.
J should be easier to understand if you can avoid pre-mature shortcut
and work in its first principle.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩210 李商隱 無題
昨夜星辰昨夜風 畫樓西畔桂堂東 身無綵鳳雙飛翼 心有靈犀一點通
隔座送鉤春酒暖 分曹射覆蠟燈紅 嗟余聽鼓應官去 走馬蘭臺類轉蓬
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm