Refactor Enum.slice to use reduce instead of recursion.