>From http://www.jsoftware.com/books/pdf/brief.pdf page 22
({.,#)/.~sum
10 1
12 1
14 1
15 2
17 2
18 1
19 2
20 2
22 2
21 1
24 2
25 1
27 1
29 1
The rest is simple:
sum (i.(#~1&=)/) |:({.,#)/.~ sum
0 1 2 6 13 17 18 19
R.E. Boss
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Raul Miller
Verzonden: maandag 3 november 2008 7:16
Aan: Programming forum
Onderwerp: Re: [Jprogramming] Insight required please!
On Sun, Nov 2, 2008 at 8:16 PM, Graham Parkhouse
<[EMAIL PROTECTED]> wrote:
> sum=: 10 12 14 15 15 17 18 19 20 22 17 19 20 21 22 24 24 25 27 29
...
> Next I would like to get a list of the indices of sum whose values only
> appear once, i.e.
In addition to the answers in this thread, and in the wiki, you could have
used your original approach if you had arranged so that you could
distinguish
between the index 0, and the fill used to arranged that ever cell of result
from your /. verb was the same shape. (And if you eliminated the extraneous
trailing dimension.
For example:
(, _1+sum ((1&[EMAIL PROTECTED])# ])/. 1+ i.#sum) -._1
0 1 2 6 13 17 18 19
Or,
(_1+sum ({. * 1=#)/. 1+ i.#sum) -._1
0 1 2 6 13 17 18 19
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm