# Restricting the domain of a function

Let f be a function {1,2,3,...,n} -> C. What is the most elegant way to restrict this function to an arbitrary subset of {1,2,3,...,n}?

In other words I would like to have an operator R which takes such a function f and a subset S of [n] and returns a function f': S -> C which coincides with f on S.