Create function on-the-fly?

So how can I solve it… i.e. be able to create functions on demand !?