latex3: errors I don't understand

I have the following code:

\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn

\cs_new:Nn \__test_current_choice_against_version: { I'm working }

\seq_new:N \g__user_defined_choice_seq
\NewDocumentCommand{\choices}{ O{;} m }{
\texttt{#2}\par
\seq_set_split:Nnn \g__user_defined_choice_seq  #1  #2
\seq_show:N \g__user_defined_choice_seq
}

\ExplSyntaxOff
\begin{document}

Choosing \choices{x;y;z;w}

\end{document}


and it doesn't seem to be doing at all what I expect.

First the \seq_show:N is creating an error and the document does not produce output. The error is:

The sequence \g__user_defined_choice_seq contains the items (without outer
braces):
>  {x}.

l.17 Choosing \choices{x;y;z;w}

?


Secondly and the reason I was trying \seq_show:N...... was because my argument is not getting split. I'm expecting that \g__user_defined_choice_seq should have four elements and not just one.

Edit

I've also tried using \seq_gset_split thinking that that might be the problem with how the argument is getting split, but that doesn't seem to make a difference.

-

You're missing braces around #1 and #2:

\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn

\seq_new:N \l__user_defined_choice_seq
\NewDocumentCommand{\choices}{ O{;} m }
{
\texttt{#2}\par
\seq_set_split:Nnn \l__user_defined_choice_seq { #1 } { #2 }
\seq_show:N \l__user_defined_choice_seq
}

\ExplSyntaxOff
\begin{document}

Choosing \choices{x;y;z;w}

\end{document}


n type arguments should always be in braces, while N arguments shouldn't (and should consist of only one token).

Also you're mixing "local" and "global". Variables with the g_ prefix should always be acted upon globally. So either use

\seq_gset_split:Nnn


or use a local variables.

-
On to the next question then. –  A.Ellett Jan 21 '13 at 23:57