On 23/01/2011 15:28, Joseph Wright wrote: > \cs_new_nopar:Npn \clist_element:Nn #1#2 { > \exp_args:No \clist_element:nn {#1} {#2} > } > \cs_new:Npn \clist_element:nn #1#2 { > \int_compare:nNnF {#2} < { 0 } > { > \clist_element_aux:nw {#2} #1 > , \q_recursion_tail \q_recursion_stop > } > } > \cs_new:Npn \clist_element_aux:nw #1#2 , #3 { > \int_compare:nNnTF {#1} = { 0 } > { \use_i_delimit_by_q_recursion_stop:nw {#2} } > { > \quark_if_recursion_tail_stop:n {#3} > \clist_element_aux:nw { #1 - 1 } #3 > } > } A couple of notes. I've gone for \int_compare:nNn for performance reasons over \int_compare:n, and I'd probably use the expansion of \int_eval:n in the 'count' functions, so that it only requires two expansions to get to the result rather than three. -- Joseph Wright