public static function partial(callable $function, $arguments)
    {
        if (!is_array($arguments))
            $arguments = array_slice(func_get_args(), 1);

        return function () use ($function, $arguments) {
            return call_user_func_array($function, array_merge(func_get_args(), $arguments));
        };
    }