Anonymous commands with Expl3

Define a temporary function:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}

\ExplSyntaxOn

\seq_new:N \l_fabian_inner_in_seq
\seq_new:N \l_fabian_inner_out_seq
\seq_new:N \l_fabian_outer_in_seq
\seq_new:N \l_fabian_outer_out_seq

\NewDocumentCommand \seq { O{,} O{\dots} d|| s m s }
 {
  \IfNoValueTF{#3}
   { \cs_set_eq:NN \__fabian_inner_process:n \use:n }
   { \cs_set_protected:Nn \__fabian_inner_process:n { #3 } }
  \IfBooleanT #4 { #2 #1 \allowbreak }
  \fabian_outer:nnn { #1 } { #2 } { #5 }
  \IfBooleanT #6 { #1 \allowbreak #2 }
 }
\cs_new_protected:Nn \fabian_outer:nnn
 {
  \seq_set_split:Nnn \l_fabian_outer_in_seq {;} {#3}
  \seq_set_map:NNn \l_fabian_outer_out_seq \l_fabian_outer_in_seq
   {
    \exp_not:n { \fabian_inner:nn { #1 } { ##1 } }
   }
  \seq_use:Nn \l_fabian_outer_out_seq {#1 \allowbreak #2 #1 \allowbreak }
 }
\cs_new_protected:Nn \fabian_inner:nn
 {
  \seq_set_split:Nnn \l_fabian_inner_in_seq { , } { #2 }
  \seq_set_map:NNn \l_fabian_inner_out_seq \l_fabian_inner_in_seq
   { \exp_not:n {\__fabian_inner_process:n { ##1 } } }
  \seq_use:Nn \l_fabian_inner_out_seq { #1 }
 }
\ExplSyntaxOff

\begin{document}
\begin{gather}
\seq[-] {1,2,3} % 1 - 2 - 3
\\
\seq{1,2;5,6;10,11} % 1, 2, ..., 5, 6, ..., 10, 11
\\
\seq*{1,2;5,6} % ..., 1, 2, ..., 5, 6
\\
\seq[\ ][\text{---}]{1,2;5,6}* % 1 2 --- 5 6 ---
\\
\seq |A_{#1}| {1,2;7,8}*
\\
\seq |A_{#1}| *{1,2;7,8}*
\end{gather}
\end{document}

enter image description here