如何对 J 中的相等值进行分组?

How to group equal values in J?

   (= <@#"1 0 ~.) 3 2 3 3 4
+-----+-+-+
|3 3 3|2|4|
+-----+-+-+

还有哪些方法?我最不喜欢它说 "1 0.

的部分

副词 key (/.) groups the right argument as specified by the left argument and applies a verb to each group. If you give it the same left and right argument you can apply the verb box (<) 将所有相等的项目组合在一起

   </.~ 3 2 3 3 4
┌─────┬─┬─┐
│3 3 3│2│4│
└─────┴─┴─┘

您可以轻松地对组求和:

   +//.~ 3 2 3 3 4
9 2 4