[ and ] are verbs just like + and - . But instead of adding or subtracting the right argument to or from the left argument they just take the value of the left or right argument.. They can be monadic or dyadic. If monadic both take the value of the right argument. Kind of like + for real numbers. If dyadic [ takes the value of left argument and ignores the right. ] is the other way around. The key here is that they are not special.
One interesting use is to do multiple assignments on one line. a =: 2 [ b =: 3 Another is to force the display of an assigned result when in immediate mode. If you were calculating something in the ijx window and the result is assigned to a name, sticking ] in front of the name saves you the trouble of reentering the name to see the result. ]bigname=:some calculation They are used mostly in tacit expressions and are especially useful there, which is probably why you think tacit when you see them. But they can be used anywhere. On Sat, Jun 6, 2009 at 6:48 PM, bill lam <[email protected]> wrote: > On Sat, 06 Jun 2009, PackRat wrote: > > Thanks, Raul, Bill, and Fraser! However, after reading your responses, > > I'm more in the dark now than before, concerning dyadic left and right! > > > > Rearranging Bill Lam's response a bit: > > > ... Firstly [ and ] are verb, in that context DOJ said they will > > > yield their noun argument. ... To be verbose, verb itself can only > > > see its immediate left or right noun arguments. ... > > > J should be easier to understand if you can avoid pre-mature shortcut > > > and work in its first principle. > > > > I am really trying to avoid what you term a "pre-mature shortcut" by > > taking the DOJ's EXACT AND LITERAL wording in its normal English sense > > without any special meanings or understandings associated with it which > > aren't stated. As I stated in my original message: > > > > Now here is where I need further enlightenment: ... > > > > Taking the Dictionary definition exactly and literally, it would > > > > appear that ... everything to the left of the "]" should be thrown > > > > out and only the "]" and its rightward elements would be returned. > > > > And you wrote: > > > Suppose a b c are verbs and you define a train f=: a [ b ] c > > > > As I said above, using the EXACT AND LITERAL wording of the DOJ meaning > > of dyadic [ and ] in the standard English sense and applying it to what > > I see in your train above, moving from right to left, the DOJ meaning > > would be to view it as ( a[b ) ] (c) , where I've parenthesized what's > > to the left and right of ] . Taking the DOJ definition at its exact > > and literal meaning, that would mean the result is c , with a[b > > being tossed out (ignored) in the process. In theory, if I gave the > > Hi Harvey, > This is not DOJ said. There is no such thing as a `tacit form > calculus' that will do symbolic calculation on a tacit form alone. > > So let's forget tacit form for the moment, I'm sure you know what [ or > ] will do when applying to nouns, and that was the _entirety_ of what > DOJ said. There is nothing particular about [ or ] as regarding to > tacit form. > > you said DOJ implied a [ b ] c will be evalulated as ( a[b ) ] (c) > This is the pre-mature shortcut. Let's defer this evaluation and > regard a [ b ] c un-evaluated. You may disagree because it contradicts > to tacit forms programming where you write a series of sentences in > tacit forms to solve problems. Bill must be wrong to say tacit forms > are not evaluated by J. Sure J will, but not by tacit form calculus. > Say if you enter a [ b ] c in session window and press enter, The > result as that will be echo in the following line is the same > a [ b ] c > So the sentence is not yet `evaluated', so will be any verb train. > > (Depending on your global setting it may display as 'a [ (b ]c)' but > ignore that for the time being) > > So what is a[b]c ? Is it a or c? Neither. a[b]c is a[b]c itself > because you did not provide a noun argument to [ or ] so that these > verbs [ and ] (also a b c) will not take any action. > > OK you now give argument x/y to it, and evaluation starts > x (a [ b ] c) y NB. 5 verbs in a train, therefore 2 fork > x (a [ (b ] c)) y NB. v1 v2 v3 v4 v5 <-> v1 v2 (v3 v4 v5) > (x a y) [ x (b ] c)) y NB. fork > (x a y) [ (x b y) ] (x c y) NB. fork > (x a y) [ foo ] bar NB. evaluate b and c > (x a y) [ bar NB. ] not evaluated until here > (x a y) NB. [ not evaluated until here > > (actual sequence of evaluating fork is undefined/parallel, but ignore > it again for the time being otherwise you'll be more puzzled) > > If you cannot understand a particular tacit form, then provide it some > x or y and do evaluation step by step. After more practice, it become > a second nature and you will be able to see what a tacit form will do > without actual evaluation. At that point you will be smarter than J > parser because you can perform tacit form calculus that J parser > cannot. > > Are you more in the dark now than before? ;-) > > -- > regards, > ==================================================== > GPG key 1024D/4434BAB3 2008-08-24 > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 > 唐詩179 王維 奉和聖製從蓬萊向興慶閣道中留春雨中春望之作應制 > 渭水自縈秦塞曲 黃山舊遶漢宮斜 鑾輿迥出千門柳 閣道迴看上苑花 > 雲裡帝城雙鳳闕 雨中春樹萬人家 為乘陽氣行時令 不是宸遊玩物華 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
