implement f()