I would use [[ instead of [ J dictionary didn't say much on side effects. On Wed, Jun 2, 2021, 7:56 AM 'Pascal Jasmin' via General < [email protected]> wrote:
> > > > > > > > On Tuesday, June 1, 2021, 07:40:22 p.m. EDT, Henry Rich < > [email protected]> wrote: > > > first is > > noun verb verb(v c v) noun NB. parses all 4 terms. > > second is > > n v v v n NB. parses rightmost 4 terms. > > And when that gets reduced to n v v n the rightmost n has already been > executed along with its side effect code, and so only now the parser will > retrieve the updated value in left n. > > > The rules are given in the parsing table > https://www.jsoftware.com/help/dictionary/dicte.htm > > Henry Rich > > On 6/1/2021 6:53 PM, 'Pascal Jasmin' via General wrote: > > I see. It has to parse the value of COUNTER at parse time? for: > > > > COUNTER [ CNT@{. 1 2 3 [ COUNTER =: 0 > > > > but It is harder to see why the same rule wouldn't apply to the left > COUNTER here: > > > > COUNTER [ ] CNT@{. 1 2 3 [ COUNTER =: 0 > > > > 1 > > > > If COUNTER needs to be checked for whether it is a conjunction, result > would be a n in first, and a v n in second (both illegal). The conjunction > possibility is probably not the actual reason. > > > > 'any v n' requires to see what any is. Because it could be x v(dyad) n, > or v v(monad) n. Execution of middle v depends on knowing which. > > > > 'any v v n' can always execute the rightmost v before having to look at > the left any. > > > > But the first example actually is 'any v v n' in its longer form, so I > still don't get why second version "works" > > > > > > On Tuesday, June 1, 2021, 06:19:25 p.m. EDT, Raul Miller < > [email protected]> wrote: > > > > > > > > > > > > CNT =: 3 : 'y [ COUNTER =: >: COUNTER' > > COUNTER [[ CNT@{. 1 2 3 [ COUNTER =: 0 > > 1 > > > > In the general case, COUNTER might have instead been a conjunction, > > which would have meant that the [ to the left of CNT in your > > expression would have been an argument to that conjunction, instead of > > being a simple verb which ignores the value from CNT. > > > > I hope this helps, > > > > > -- > This email has been checked for viruses by AVG. > https://www.avg.com > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
