F=: </.~ +/\@(-.@+._1&|.)@:=&(<,'&')
   F ;:'4&count int 3 8&inrange'
+-----------+-----+---------------+
|+-+-+-----+|+---+|+---+-+-------+|
||4|&|count|||int|||3 8|&|inrange||
|+-+-+-----+|+---+|+---+-+-------+|
+-----------+-----+---------------+

Thanks,

-- 
Raul


On Sun, Jan 25, 2015 at 11:32 PM, 'Pascal Jasmin' via Programming
<[email protected]> wrote:
> I want the following output from parsing the string on the right,
>
>   1 1 1 0 2 2 2 </. ;: '4&count int 3 
> 8&inrange'┌───────────┬─────┬───────────────┐
> │┌─┬─┬─────┐│┌───┐│┌───┬─┬───────┐│
> ││4│&│count│││int│││3 8│&│inrange││
> │└─┴─┴─────┘│└───┘│└───┴─┴───────┘│
>
> └───────────┴─────┴───────────────┘
>
> or
>
> 0 1 2 2 2 </. ;: 'str int 3 8&inrange'
> ┌─────┬─────┬───────────────┐
> │┌───┐│┌───┐│┌───┬─┬───────┐│
> ││str│││int│││3 8│&│inrange││
> │└───┘│└───┘│└───┴─┴───────┘│
> └─────┴─────┴───────────────┘
>
>
> basically, I want to group 3 words together if the middle word is a '&'
>
>
> How can I calculate either the left hand argument to </. or otherwise create 
> the groupings?
> ----------------------------------------------------------------------
> 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