curry: Basic implementation based on function arity