> nit why p ? this looks obfuscated, can we replace with func, f, or something?

Usually `p` is used for predicate functions, but I can change that to `f` if you don't like that.