---Raul Miller wrote:
> Here's how I would describe J's parsing of
> 3 : 0''
>   'etc.'
> )
>
> First, that initial line is broken up into words:
> +-+-+-+--+
> |3|:|0|''|
> +-+-+-+--+
>
> Next, this sentence gets parsed according to the rules outlined
> in http://www.jsoftware.com/help/dictionary/dicte.htm
>
> Specifically:
> queue                 stack           action
> § 3 : 0 ''                            move
> § 3 : 0               ''              move
> § 3 :                 0 ''            move
> § 3                   : 0 ''          move
> §                     3 : 0 ''        4 Conj
> §                     verb ''         move
>                       § verb ''       0 Monad
>
> In other words, first the system needs to replace 3 : 0 with
> the body of the verb it represents (and to do so it needs to
> read that verb's definition, from the following lines).  And then,
> once it has done so, it will evaluate that verb as a monad
> with the right argument ''.
>
> If there's any problems understanding this, it might be that
> this example is so simple -- there's almost nothing going
> on here to understand.

Up until now I have used this construct, understanding the effect but not 
understanding how it works. It still hadn't clicked for me after my first 
reading of Raul's description above, but after fiddling with examples (clearing 
up some of my mis-conceptions in the process) and re-reading his description I 
think I now get it!

The "3 : 0" basically says - "the lines following this one, until a line 
containing only a ')', will define this verb."  Anything on the same line but 
following the "3 : 0" becomes the right argument to that verb. (I realise this 
is pretty much what Raul said above, but maybe repetition will help!)

So:
   3 : 0 (4 5)
+/y
)
9
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to