I expect generic comptime functions to be available in the next release of guppylang.
Quantinuum/guppylang#1630
We should update the docs to reflect the fact that you no longer have to do the metaprogramming trick to generalize comptime functions.
Update this section -> https://docs.quantinuum.com/guppy/language_guide/comptime.html#generalizing-comptime-functions