parens are not needed for 

test=: +: ifC


in either of our versions.

For the adverb definition 

flag1_z_ =: (] controlA_z_ =: 1 : ('flag1_z_ =: 1';'o=. u y';'flag1_z_ =: 
0';'o';':';'flag1_z_ =: 1';'o=. x u y';'flag1_z_ =: 0';'o') ( finallyC_z_ 
('flag1_z_' assign 0:))) 0


Parens are needed after the ' 1 : ' because it is a multiline explicit 
definition "hacked" into a single line with ; joins.
Parens are needed after the 'flag1_z_ =:' because the line is actually 2 
definitions on 1 line.  The value assigned to the noun is the trailing 0 after 
all of the parens.
The leading ] is needed so that after controlA is defined, it is applied and 
passes the 0 left to =:

If you type controlA into the console, you will see the expanded multiline 
version


you might need this one too, to understand.


finallyC_z_ =: 2 : 'u :: ((v)][:13!:12(''''[]))'

It is used to ensure that if ' u y ' gives an error, that flag1_z_ will get 
reset to 0.



 
----- Original Message -----
From: Brian Schott <[email protected]>
To: General forum <[email protected]>
Cc: 
Sent: Monday, September 16, 2013 11:27:37 AM
Subject: Re: [Jgeneral] Bug in adverb define

Twice now in this thread, parentheses have made a serious difference in
results. If that difference has been explained I have missed it and would
appreciate an explanation.

In Pascal's message parens were need around the explicit definition of an
adverb.

In Jose' s (Pepe's?) message the parens were used as follows and different
results are produced without parens.

   st=. 7!:2@:] ; 6!:2

   NB. Explicitly...

   controlA_z_ =: 1 : 0
flag1_z_ =: 1
o=. u y
flag1_z_ =: 0
o
)

   ifC=: 1 : 'if. flag1_z_ do. u y else. y end.'

   ( test=: +: ifC )



-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to