Generate functions inside a function from string

I created a separate thread here summarizing generally what I want: