iff function

Apply a function if and only if test is TRUE