Anonymous functions in Dictionary with generator syntax

The simplest thing is to use Function instead of Any. It won’t really help performance, but at least is a bit more specific about the intent.

If the dictionary is going to contain many totally different functions, then given code like d[x](s), the compiler doesn’t know what function will be called, precluding many optimizations. With the first comprehension, we know all the functions are “similar enough” that they share code, so some optimizations are possible.