scalp icon indicating copy to clipboard operation
scalp copied to clipboard

Type PartialFunction

Open pawaclawczyk opened this issue 8 years ago • 0 comments

Type partial function represents a function which is undefined for some elements of the domain.

Example

f(x) = 42 / x is not defined at x equal 0

Minimal interface

interface PartialFunction
{
    public function isDefinedAt($x): bool;
    public function __invoke($x);
}

Maybe some additional logic and encapsulation in trait could be a good idea. TDB

pawaclawczyk avatar Sep 13 '17 20:09 pawaclawczyk