Quantcast
Channel: Active questions tagged mapping - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 50

Map arbitrary operation on zipped iteration over two comma-separated lists

$
0
0

I am trying without success to combine thesetwo approaches into something powerful that would allow me to zip-iterate over two lists and do arbitrary cool things:

\zip{a,b,c}{1,2,3}{#1-#2 }

would expand to

a-1 b-2 c-3 

And why not

\zip[#1/#2][#3::#4]    {a/A,b/B,c/C}    {1::I,2::II,3::III}    {Grand #1 is #2 but grand #3 is #4.\\}

would expand to

Grand a is A but grand 1 is I.\\Grand b is B but grand 2 is II.\\Grand c is C but grand 3 is III.\\

My best attempt so far was to append this code after @BrunoLeFloch's solution:

\NewDocumentCommand{\zip}{mmm} {  \cs_set:Npn \__egreg_apply_aux:nn ##1 \q_stop { #3 }  \clist_map_zip_ii:VVN #1 #2 \__egreg_apply_aux:nn }

with no luck, and maybe the arcanes of Interface3 find me not pure-hearted enough to unveil their secrets yet :'(


Viewing all articles
Browse latest Browse all 50

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>