Alright, then, here we go.
As you can see below, the main part of the coding is parsing the comma separated range input. After that, it's easy to check what number you're up to in the enumerate environment (or whatever) and conditionally display the item.
You can copy and paste from here on into an empty .tex
document and it should just work:
%% First of all, I'm using the expl3 package to do most of this coding. Makes some things easier.
\documentclass{article}
\usepackage{expl3}
\ExplSyntaxOn
%% Here's the function to loop over comma-list range input like -2,4-6,8,10-
:
\prg_new_conditional:Nnn \i_in_range:nn {TF,T,F} {
\bool_set_false:N \l_tmpa_bool
\clist_map_inline:nn {#2} {
\parse_range:w ##1 - \q_marker - \q_nil #1 \q_nil
}
\bool_if:NTF \l_tmpa_bool \prg_return_true: \prg_return_false:
}
%% And the auxiliary function to return whether the input argument is contained within the range:
\cs_set:Npn \parse_range:w #1 - #2 - #3 \q_nil #4 \q_nil {
\tl_if_eq:nnTF {\q_marker}{#2}{
\intexpr_compare:nT {#4=#1} {\bool_set_true:N \l_tmpa_bool}
}{
\tl_if_empty:nTF {#2}{
\intexpr_compare:nT {#4>=#1} {\bool_set_true:N \l_tmpa_bool}
}{
%% Sorry about this break here; Stackoverflow's display engine has a bug:
\tl_if_empty:nTF {#1}{
\intexpr_compare:nT {#4<=#2} {\bool_set_true:N \l_tmpa_bool}
}{
\intexpr_compare:nT {#4>=#1} {
\intexpr_compare:nT {#4<=#2}
{\bool_set_true:N \l_tmpa_bool}
}
}
}
}
}
\cs_generate_variant:Nn \i_in_range:nnTF {nV}
%% This is the command to input each item of your list:
\newcommand\numitem[1]{
\i_in_range:nVTF {\value{enumi}+1}{\l_item_range_tl}{
\item #1
}{
\stepcounter{enumi}
}
}
%% And the enumerate environment with a range argument:
\newenvironment{someitems}[1]{
\tl_set:Nn \l_item_range_tl {#1}
\begin{enumerate}
}{
\end{enumerate}
}
\ExplSyntaxOff
%% Finally, an example:
\begin{document}
\begin{someitems}{-2,4-6,8,10-}
\numitem{one}\numitem{two}\numitem{three}
\numitem{four}\numitem{five}\numitem{six}
\numitem{seven}\numitem{eight}\numitem{nine}
\numitem{ten}\numitem{eleven}
\end{someitems}
\end{document}