The guard for the predicate should be on the clause where you actually call the function :)