---Graham Parkhouse 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.
>
> 0 1 2 6 13 17 18 19

> Why doesn't this give it to me?
>
>    sum ((1&[EMAIL PROTECTED])#])/. i.#sum

>From the dictionary page for key: u/.
u is applied to each collection of y having identical keys.
In your case u is a fork (1&[EMAIL PROTECTED] # ]) i.e. (f g h).
You don't want to apply the fork to each collection of y, you want apply copy 
(#) to the result of f/. and h/.  except that you want h to be < rather than ] 
(to see why try: sum ]/. i.#sum).

This works:
((1&=@:#/. ;@:# </.) [EMAIL PROTECTED]) sum
0 1 2 6 13 17 18 19

> Is there an altogether different way to get the result I want?

Probably, but I'll leave that for others!
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to