Function and mask

Hi there,
I would like to know if it is possible to apply function as a mask for other object.
This is a real pain cause I’m struggling with this for hours and I cant get it work.
Thanks in advance.