With Elvex & Raul's help we have...
(~.@{.,.<@(;:inv)/./) list2
┌────┬─────────────────────────┐
│bird│one eight fourteen │
├────┼─────────────────────────┤
│cow │two three five six seven │
├────┼─────────────────────────┤
│dog │four nine eleven thirteen│
├────┼─────────────────────────┤
│cat │ten │
├────┼─────────────────────────┤
│pig │twelve fifteen │
└────┴─────────────────────────┘
As Raul points out, comma with spaces are a bit more work, particularly if
you must leave off a comma after the last ID in the list. So what would be
the the verb for this?
┌────┬─────────────────────────────┐
│bird│one, eight, fourteen │
├────┼─────────────────────────────┤
│cow │two, three, five, six, seven │
├────┼─────────────────────────────┤
│dog │four, nine, eleven, thirteen │
├────┼─────────────────────────────┤
│cat │ten │
├────┼─────────────────────────────┤
│pig │twelve, fifteen │
└────┴─────────────────────────────┘
Skip Cave
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm