> This scan pattern seems so simple in explicit code,
> that it's surprizing that in J to run it
> efficiently it requires quite a trick:
>
>    ([^:(0=]))~ /\.&.|. 3 0 0 2 0 4
> 3 3 3 2 2 4
>

I've been looking for something like this, only I think I conceived it in
another context:

An adverb I call trace, that shows a series of states, given a finite state
machine, an initial state, and a series of transitions:

   fsm trace S_init,transitions

My initial solution was

   fsm/\init,transitions

but I can see how

   fsm~/\. &. |.

would work as well.

Therefore:

    trace =: 1 : 'u~/\.&.|.'

works for me.
------------------------------------------------------------------------
|\/| Randy A MacDonald   | APL: If you can say it, it's done.. (ram)
|/\| [EMAIL PROTECTED]  |
|\ |                     | The only real problem with APL is that
BSc(Math) UNBF'83        | it is "still ahead of its time."
Sapere Aude              |     - Morten Kromberg
Natural Born APL'er      | Demo website: http://156.34.81.62/
-----------------------------------------------------(INTP)----{ gnat }-

about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to