Perhaps this is ok? NB. + : NB. each entry is nextState.outputCode sc=:0 10#:10*".;._2(0 :0) 1.1 1.1 1.1 NB. 0 initial state 1.2 2.1 1.1 NB. 1 got '+', waiting for first ':' 1.2 3.3 4.1 NB. 2 got '+:', handle next char 1.1 3.0 3.0 NB. 3 got '+::', waiting for next '+' 1.2 3.3 4.0 NB. 4 got '+:x' waiting for + or : ) pp=: '+:'i.a. Here, each '+' corresponds to an output word. That word contains either the content following the first ':' or the final character before the next '+' if there is no such content. Thus: (0;sc;pp)&(smoutput@;:) ;._2(0 :0) +a:b:c+A:B:C+ +++ +:+:+ +123:+456:+ +a:c+d:e+ +a:c+d:e+f:g+ +:123+34+ +123+:34+ ) +-+-+-+ |b|B|+| +-+-+-+ +-+-+-+ |+|+|+| +-+-+-+ +-+-+-+ |:|:|+| +-+-+-+ +-+-+-+ |:|:|+| +-+-+-+ +-+-+-+ |c|e|+| +-+-+-+ +-+-+-+-+ |c|e|g|+| +-+-+-+-+ +---+-+-+ |123|4|+| +---+-+-+ +-+--+-+ |3|34|+| +-+--+-+ Good enough? Alternatively, we could produce no word whatsoever for the case where there's no content after the first : Alternatively, perhaps you could specify the rules you want to be followed (even if they are more complicated than what a single ;: can handle)? -- Raul
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
