cast to function doesnt work

so I’ve gotten the following logic:
1.