The animal control officer wants to keep track of the animals in a city. The officer tags all the animals with a serial number. He keeps a list of all the animals he has tagged, along with each serial number.
list ┌────┬───┬───┬───┬───┬───┬───┬────┬───┬───┬───┬───┬───┬────┬───┐ │ bird │ cow│ cow│ dog │ cow │ co w │ cow │ bird │ dog │ cat │ dog │ pi g│ dog │ bird │ pig │ ├────┼───┼───┼───┼───┼───┼───┼────┼───┼───┼───┼───┼───┼────┼───┤ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ └────┴───┴───┴───┴───┴───┴───┴────┴───┴───┴───┴───┴───┴────┴───┘ The officer now wants to make a second list showing each type of animal along with all the serial numbers tagged for each animal. list2 ┌────┬──┬──┬──┬──┬─┐ │ bird │ 1 │ 8 │ 14 │ │ │ ├────┼──┼──┼──┼──┼─┤ │ cow │ 2 │ 3 │ 5 │ 6 │ 7│ ├────┼──┼──┼──┼──┼─┤ │ dog │ 4 │ 9 │ 11│ 13│ │ ├────┼──┼──┼──┼──┼─┤ │ cat │ 10 │ │ │ │ │ ├────┼──┼──┼──┼──┼─┤ │ pig │ 12 │ 15 │ │ │ │ └────┴──┴──┴──┴──┴─┘ What is the shortest J expression to generate list2? (Tacit would be nice) Skip ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
