tailsList<T> function
Returns everything but first element.
Implementation
List<List<T>> tailsList<T>(Iterable<T> l) {
if (l.isEmpty) {
return [[]];
}
List<List<T>> result = [];
var copy = List.from(l);
for (int i = 0; i < l.length; i++) {
result.add(List.from(copy));
copy.removeAt(0);
}
return result + [[]];
}