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,
--
Raul
On Tue, Jun 1, 2021 at 6:08 PM 'Pascal Jasmin' via General
<[email protected]> wrote:
>
> CNT =: 3 : 'y [ COUNTER =: >: COUNTER'
>
> COUNTER [ CNT@{. 1 2 3 [ COUNTER =: 0
>
> 0
>
> COUNTER
> 1
>
> workaround
>
> 3 :'COUNTER' [ CNT@{. 1 2 3 [ COUNTER =: 0
>
> 1
>
> J is being too smart in short circuiting constant [ ....at console (jqt)
> ----------------------------------------------------------------------
> 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