printers[i] = () { write(i); };

I know it looks silly but if you make that:

         printers[i] = (int i) { return () { write(i); }; }(i);

it will do what you want.

Or, the slightly prettier (imo)

          printers[i] = ((i) => () => write(i))(i);

Or, if you need to force it to return void:

          printers[i] = ((i) => {write(i);})(i);

Reply via email to