Make apply a function