visitor for 'toFunction'