On Mon, Jul 27, 2009 at 8:01 AM, Dan Bron<[email protected]> wrote:
> So, instead, I've given the user the ability to select his own
> "end of strand" marker.  Or, rather "beginning of strand" marker:
>
>           | 'this is' 4 'words' 'of strand notation'  s|
>        +-------+-+-----+------------------+
>        |this is|4|words|of strand notation|
>        +-------+-+-----+------------------+

Let us imagine you could pick an arbitrary word to
mark the end of a strand.  Perhaps 'end'.  (I am
going to reject ideas like getting rid of the current
definitions of tokens, because that does not work in
any current version of J -- I hope you do not mind.)

Then, you could do something like this:

   ] 'a' 2 'b' 3 'c' end
+-+-+-+-+-+
|a|2|b|3|c|
+-+-+-+-+-+

I do not know if this mechanism is desirable,
but it seems easy enough to implement:

continuestrand=:2 :0
  if.nc<'u' do.
    u n
  else.if.L.n do.
    continuestrand(m;n)
  else.
    continuestrand(<m)
  end.end.
)
end=:continuestrand''

Note:  In reality, the "end of strand" mechanism,
here, is the verb on the far left.  Remember that
J's parser consumes its queue from right to left.

I have arbitrarily decided that the "end of strand"
word must be a monadic verb, and that the result
of the strand as a whole is the result of that verb.

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

Reply via email to