Why do we put a 0# here: @[`.;t;@[;`sym;`g#]0#]

I know roughly what apply does: 

In the other apply we are applying to tables in the namespace the inner apply.

The inner apply is grouping on the sym column and it is a projection hence the empty slot.

But what exactly is 0# doing here? 

TLDR: the expression initialises a list t of tables in the default namespace, setting the grouped attribute on the symbol column and removing all the table rows. 

How that? The function called is not Apply but Amend At @ in its ternary form.

The first argument is the default namespace ``.`, which, as a namespace, is also a dictionary.

The second argument t will be a symbol vector of names of tables in the default namespace; i.e. globals.

The third argument is the function to be applied to each table. You’ve already spotted that the unary projection @[;sym;g#] sets the grouped attribute on the sym column. It is composed (by juxtaposition) with the unary projection 0#. Applied to a table, 0# removes all the rows.

So the function applied to each table named in t is the composition @[;sym;g#] 0#. That is, remove the rows and set grouped on the sym column.