Ad-hoc functional programming