I have a list of strings, and a corresponding set of categorisations:
* strings ← 'foo' 'bar' 'abc' 'def' 'ghi' 'jkl'* * categories ← 1 1 0 2 1 0* I now need to group these strings according to category. In other words, when applying operation X, I need the following output: * categories X strings* ┏→━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃┏→━━━━━━━━━━┓ ┏→━━━━━━━━━━━━━━━━┓ ┏→━━━━┓┃ ┃┃"abc" "jkl"┃ ┃"foo" "bar" "hgi"┃ ┃"def"┃┃ ┃┗∊━━━━━━━━━━┛ ┗∊━━━━━━━━━━━━━━━━┛ ┗∊━━━━┛┃ ┗∊∊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ What is the best way to solve this?
