I am trying to locate specific patterns of a prescribed length within data.

For instance I might want to find occurrences of exactly 2 fives in the
following
 
dat=:0 7 8 8 8 9 2 2 5 5 5 3 8 8 8 0 0 5 5 9 6 8 8 8 8 4 0 6 4

2 5 pattern dat
17
the result should ignore the earlier '5 5 5'

Now looking for a pattern of exactly 3 eights
3 8 pattern dat
2 12
Again the 4 eights would be ignored

I have been trying to use E. but have been confounded by finding a
'universal bounding' of each  specific pattern.

Ideas and help would be appreciated.

David

 

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

Reply via email to