non-greedy match for function, support curried function