$asBools = partial_apply('array_map', 'boolval');
$asBools(['hello', '', 'world']) === [true, false, true]
$asBools([-2, -1, 0, 1, 2]) === [true, true, false, true, true]
array_filter and array_reduce get this wrong, requiring awkward argument-shuffling: $inverseFilter = partial_apply(flip('filter'), 'boolNot');
$inverseFilter([-2, -1, 0, 1, 2]) === [2 => 0]
array_keys($inverseFilter(['foo' => true, 'bar' => false])) === ['bar']
$allTrue = partial_apply(flip(partial_apply(flip('array_reduce'), 'boolAnd')), true);
$allTrue(['hello', 'world']) === true
$allTrue([true, true, 0, true]) === false
Note that a) if specialisation was easy, there would be no need for default arguments and b) having default arguments at the end is exactly the wrong way around for making specialisation not suck.We could sweep this under the rug by saying it's awkward because it's not idiomatic PHP; but one reason why it's not idiomatic is that it's awkward!
Just look at Javascript, where functions are slightly less awkward; there are lots of functional APIs in wide use, eg. Underscore.