/** * @return mixed|callable */ public static function slice() { $args = func_get_args(); /** * Returns the elements of the given list from start (inclusive) to end (exclusive). * Curried version of array_slice * * @category List * * @param int $start * @param int $end * @param array $arr * * @return array * @throws Exception */ $_slice = function ($start, $end, $arr) { $arr = P::toArray($arr); Exception::assertArray($arr); Exception::assertInteger($start); if ($end === NULL) { $end = count($arr); } Exception::assertInteger($end); return array_slice($arr, $start, $end - $start); }; return call_user_func_array(self::curry3($_slice), $args); }