Here, I think we're talking about M=: (a.=LF)+2*a.e.'0123456789'
S0=: +.".>cutLF {{)n 1j1 2j1 1j1 NB. start here 1j0 2j0 1j0 NB. non-newline 1j0 1j2 1j0 NB. newline }} The columns correspond to character classes defined in M: column 2 is numbers, column 1 is line feeds, column 0 is everything else. The rows correspond to state. Row 0 is the initial state (state 0). Row 1 is the typical state after encountering the first character (state 1). Row 2 is the typical state after encountering a new line (state 2). When in state 2, encountering a second newline emits the current word and puts the machine at state 1, so state 1 which means that if there were three newlines in a row we would not get a subsequent box boundary for the third newline. A sequence of four newlines would result in two boxes, each containing a pair of newlines. I should have used more accurate comments. Perhaps: S0=: +.".>cutLF {{)n 1j1 2j1 1j1 NB. start here 1j0 2j0 1j0 NB. typical state 1j0 1j2 1j0 NB. single newline }} I hope this makes sense, -- Raul On Fri, Jan 13, 2023 at 12:36 PM Pawel Jakubas <jakubas.pa...@gmail.com> wrote: > > When looking at S0 as it it is used with M where 0 is other characters, 1 > is LF and 2 digits .... > I would expect rows to follow this and you have comments that seems not the > case. For example the third row in S0 is > > 1j0 1j2 1j0 NB. newline > > I would expect it to represent digit. No? > > Also, when we take first row of S0 > 1j1 2j1 1j1 NB. start here > > The first element indicates that when being in "other characters" > state the next one is "other character" > > then we transit to LF state without emission action but setting > beginning of the next word. Shouldn't > > this setting be only after LF2 (LF -> LF)? > > Thanks! > > 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