On Fri, Sep 26, 2008 at 12:56 PM, R.E. Boss <[EMAIL PROTECTED]> wrote:
>   >./(]+/@:|@:*;.1~  0 1 [EMAIL PROTECTED])(2,}.-}:)1 2 2 2 3 5 6 7 8 6 7 8
> 4

1 2 2 2 3 5 6 7 8 6 7 8 was not a valid argument since the domain
was sorted lists of integers.  Also:

   (]+/@:|@:*;.1~  0 1 [EMAIL PROTECTED])(2,}.-}:)1 12 13 13 14
1 3
   (]+/@:|@:*;.1~  0 1 [EMAIL PROTECTED])(2,}.-}:)1 12 12 13 13 14
1 3
   (]+/@:|@:*;.1~  0 1 [EMAIL PROTECTED])(2,}.-}:)1 12 13 13 13 14
1 3

But I did like using ;. on a boolean list that starts with 1.

However, on further thought, given the ambiguity of the design, probably
extracting the subsequence and then classifying it from there would
be appropriate:
   incseq=: #~[:(#]=>./)[:#;.1 1:,1 < }.-}:
   ]example=: incseq 1 12 13 13 13 14
12 13 13 13 14
   incseq 2 4 5 6 12
4 5 6
   incseq 1 2 3 4 5 6
1 2 3 4 5 6

Once you have that sequence, you can do stuff like
   #example
5
   #~.example
3
  #/.~example
1 3 1
NB. the second number in the unique sequence has three copies in the result

Thanks,

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

Reply via email to