The sequential machine is a very simple device.

When it emits a word, there's a starting index and an ending index and
it emits all of that subsequence.

The emit vector mechanism is a minor adjustment to emit word -- it
basically just changes the current ending index. It still includes the
entire subsequence.

If you want something different, that would be done either before or
after processing with this mechanism.

I hope this helps,

-- 
Raul

On Mon, Jan 16, 2023 at 7:01 AM Pawel Jakubas <jakubas.pa...@gmail.com> wrote:
>
> Hi Raul,
>
> I am not giving up on learning multiple words action. I have seen the
> example you referenced and try to use it on example  we processed.
>    M=: (a.=LF)+2*a.e.'0123456789'
>    S=: +.".>cutLF {{)n
> 1j0 0j0 2j1  NB. start here
> 1j0 3j0 2j1  NB. other
> 1j5 3j5 2j0  NB. digit
> 1j0 4j1 2j1  NB. LF
> 1j3 3j0 2j2  NB. LF2
> }}
>
>    test1=: {{)n
> 1000ddd
>   2000
>
> 1x
> x2
> }}
>    (0;S;M;0 _1 0 _1) ;: test1
> ┌──────────────┬─┬─────┐
> │1000ddd   2000│ │1x x2│
> └──────────────┴─┴─────┘
>    (5;S;M;0 _1 0 _1) ;: test1
>  0 _1 0 2 2 1    NB. 1
>  1  0 2 2 2 0     NB. 0
>  2  0 2 2 2 0     NB. 0
>  3  0 2 2 2 0     NB. 0
>  4  0 2 0 1 5     NB. d
>  5 _1 1 0 1 0    NB. d
>  6 _1 1 0 1 0    NB. d
>  7 _1 1 1 3 0    NB. LF
>  8 _1 3 0 1 0    NB. space
>  9 _1 1 0 1 0    NB. space
> 10 _1 1 2 2 1   NB. 2
> 11 10 2 2 2 0   NB. 0
> 12 10 2 2 2 0   NB. 0
> 13 10 2 2 2 0   NB. 0
> 14 10 2 1 3 5   NB. LF
> 15 _1 3 1 4 1   NB. LF
> 16 15 4 2 2 2   NB. 1
> 17 16 2 0 1 5   NB. x
> 18 _1 1 1 3 0   NB. LF
> 19 _1 3 0 1 0   NB. x
> 20 _1 1 2 2 1   NB. 2
> 21 20 2 1 3 5   NB. LF
>
> This is unexpected to me as I though to see
> ┌──────────────┬─┬─────┐
> │1000 2000   │1 2│
> └──────────────┴─┴─────┘
> For example, 5 action is invoked when in interaction number 4, so it should
> only include 0, 1, 2,3. In interaction number 4 j=_1 and ddd should not be
> included. Any hints what I am doing wrong?
>
> Thanks and best regards,
> Pawel
> ----------------------------------------------------------------------
> For information 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