On Wed, Jul 29, 2009 at 8:57 AM, Roger
Stokes<[email protected]> wrote:
> NB. trace can produce an incorrect result.
>
>   require 'trace'
>
>   a =: 6
>   trace '(a=:7) ,  a'
...
> 7 7
>
>   NB. the correct result is shown by:
>
>   a =: 6
>   (a=:7) , a
> 7 6

Wow, I had to look up in the dictionary whether this behaivior is
supported.  The chapter "Parsing and Execution" says

> Parsing proceeds by moving successive elements (or their values except in the 
> case of proverbs and names immediately to the left of a copula) from the tail 
> end of a queue (initially the original sentence prefixed by a marker §) to 
> the top of a stack (initially four markers), and eventually executing some 
> eligible portion of the stack and replacing it by the result of the execution.

and later it says

> The executions in the stack are confined to the first four elements only, and 
> eligibility for execution is determined only by the class of each element 
> (noun, verb, etc., an unassigned name being treated as a verb), as prescribed 
> in the following parse table. The classes of the first four elements of the 
> stack are compared with the first four columns of the table, and the first 
> row that agrees in all four columns is selected. The bold italic elements in 
> the row are then subjected to the action shown in the final column, and are 
> replaced by its result. If no row is satisfied, the next element is 
> transferred from the queue.

which defines exactly when a name is converted to its value or a
proverb (the latter for names whose value is verb or undefined).  For
some reason I thought the dictionary left when this happens during
execution partially undefined on purpose, but no.

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

Reply via email to