If you aren't paranoid of parentheses:
uniqRAM =: (i.=i:)~
also seems to work.
Roger Hui wrote:
Also:
uniq=: i.~ = i:~
x=: 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9
unique x
0 0 1 0 0 0 1 1 0 0 0 1 0 1 0
uniq x
0 0 1 0 0 0 1 1 0 0 0 1 0 1 0
----- Original Message -----
From: "Sherlock, Ric" <[EMAIL PROTECTED]>
Date: Tuesday, June 12, 2007 2:56 pm
Subject: RE: [Jprogramming] Finding unique strings in a box
Others have provided solutions for the "unique" that you requested.
Here is a solution that gives a boolean list of all the unique (occur
exactly once) elements.
unique=: [:-. ]e. -.@:~: #]
unique box
0 0 1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm