implement a curry function for an arbitrary number of arguments.