The way the TP currently generates the code for filling in holes of a template, temporary variables are created for every item because list appending happens in a flipped order

Solutions would be:

  1. delay generating quotation by the TP until the final Doc() call - but as previous methods take expression arguments, that we should preserve, this might not work at all.
  2. apply a macro at the final .Doc call, to optimize this
  3. do a global optimizer that recognizes list creation by repeated :: operator and let expressions and flatten it to an array and use List.ofArray on it (as currently simple list expressions are translated)