Nice! Thanks to Henery Rich & R.E. Boss. For me, I want to list the dups just once. So I made this "find duplicates (and list them once)" verb:
fdp=. ~.@(#~-.@~:) Works great! I had tried this: ~.a#~1<+/ e. a=. 4 6 8 6 5 8 6 6 6 9 6 8 But my scheme doesn't scale well. I get "out of memory" errors on large lists, so it is very wasteful of space, and it is WAY slower. a=. ?1000$5000 (/:~fdp a) -: (/:~ ~.a#~1<+/ e. a) 1 ts 'fdp a' 5.99449e_6 4224 ts '~.a#~1<+/ e. a' 0.00294153 1.07405e6 Skip Skip Cave Cave Consulting LLC On Sun, Jan 14, 2018 at 10:44 AM, R.E. Boss <[email protected]> wrote: > (-.@~:)4 6 8 6 5 8 6 6 6 9 > 0 0 0 1 0 1 1 1 1 0 > > > R.E. Boss > > > > -----Original Message----- > > From: Programming [mailto:[email protected]] > > On Behalf Of Skip Cave > > Sent: zondag 14 januari 2018 17:34 > > To: [email protected] > > Subject: [Jprogramming] Finding duplicates > > > > I have a string of integers. How do I list just the duplicates in the > string? > > > > Skip > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
