Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cs_new:Nn clist_count:NN
- {
- int_set:Nn l_tmpa_int {0}
- clist_set_eq:NN l_tmpa_clist #2
- bool_until_do:nn
- {
- clist_if_empty_p:N l_tmpa_clist
- }{
- clist_pop:NN l_tmpa_clist l_tmpa_tl
- int_add:Nn l_tmpa_int {1}
- }
- int_set_eq:NN #1 l_tmpa_int
- }
- cs_new:Npn clist_length:N #1 {
- int_eval:n {
- 0 clist_map_function:NN #1 tl_elt_count_aux:n
- }
- }
- cs_new:Nn clist_nth:Nn {
- int_compare:nTF { clist_length:N #1 < #2 }
- { ERROR }
- {
- exp_after:wN clist_nth_aux:nn exp_after:wN {#1} #2
- }
- }
- cs_new:Nn clist_nth_aux:nn {
- clist_nth_aux_i:nnnw {1}{#2} #1 , q_recursion_tail q_recursion_stop
- }
- cs_new:Npn clist_nth_aux_i:nnnw #1#2#3, {
- quark_if_recursion_tail_stop:n {#3}
- int_compare:nTF {#1==#2}
- {
- use_i_delimit_by_q_recursion_stop:nw {#3}
- }
- {
- clist_nth_aux_i:fnnw { int_eval:n {#1+1} } {#2}
- }
- }
- cs_generate_variant:Nn clist_nth_aux_i:nnnw {f}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement