Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing duplicates in comma lists #917

Closed
blefloch opened this issue May 14, 2021 · 0 comments
Closed

Removing duplicates in comma lists #917

blefloch opened this issue May 14, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@blefloch
Copy link
Member

I'm just recording the bug now, it opens up a whole can of worms about commas in comma-list items, which I don't want to worry about any time soon.

The \clist_remove_duplicates:N function does not treat correctly items with commas (or leading/trailing spaces, but the bug is then more subtle). It "flattens" the list somewhat, turning these items-with-commas into multiple items:

\clist_set:Nn \l_tmpa_clist { a , {a,b,c,d} , b }
\iow_term:x { length:~\clist_count:N \l_tmpa_clist }
\clist_show:N \l_tmpa_clist 
%
\clist_remove_duplicates:N \l_tmpa_clist
\iow_term:x { length:~\clist_count:N \l_tmpa_clist }
\clist_show:N \l_tmpa_clist

gives a first list of length 3 with items {a}, {a,b,c,d}, and {b}, and a second one with length 5 with items {a}, {a}, {b}, {c}, {d}.

@blefloch blefloch added expl3 bug Something isn't working labels May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant