TableGen List Manipulation

I see that one can take slices of lists, but is there
any way to conditionally take a slice?

For example, let's say I have this (fictitious) code:

class FOO<list<string> names> {
  string First = names[0];
  string Middle = !if(!eq(!length(names), 3), names[1], "");
  string Last = !last(names);

Is there currently a way to implement this behavior or should I
code up some new operators?


There isn't a good way to do this right now. Would it make more sense to add a high level operator that does what you want, instead of a bunch of primitives?


That's what I'm looking into.