Do you really want to say something like the following?
\makematrix{2}{5}{1}{3}{7}{-1}{2}{0}{-3}{3}{4}{5}
According to your question this should be the input style you want. Maybe it could be improved by using line breaks
\makematrix{2}{5}
{1}{3}{7}{-1}{2}
{0}{-3}{3}{4}{5}
but I don't think it's a great improvement over
\begin{bmatrix}
1 & 3 & 7 & -1 & 2 \\
0 & -3 & 3 & 4 & 5
\end{bmatrix}
Do you?
OK, it's not the style CAS software uses. Can we do as follows?
\makematrix{1,3,7,-1,2;0,-3,3,4,5}
Certainly so. The optional argument to \makematrix sets the delimiters (default b; change it if you like p by default); the mandatory argument contains the matrix entries, rows separated by semicolons, entries in the same row by commas.
\documentclass{article}
\usepackage{amsmath}
\ExplSyntaxOn
\NewDocumentCommand{\makematrix}{O{b}m}
{
\hpecoraro_matrix_make:nn { #1 } { #2 }
}
\seq_new:N \l__hpecoraro_matrix_rows_seq
\cs_new_protected:Nn \hpecoraro_matrix_make:nn
{
\seq_set_split:Nnn \l__hpecoraro_matrix_rows_seq { ; } { #2 }
\begin{#1matrix}
\seq_map_function:NN \l__hpecoraro_matrix_rows_seq __hpecoraro_matrix_dorow:n
\end{#1matrix}
}
\cs_new_protected:Nn __hpecoraro_matrix_dorow:n
{
\clist_use:nn { #1 } { & } \
}
\ExplSyntaxOff
\begin{document}
Brackets
[
\makematrix{1,3,7,-1,2;0,-3,3,4,5}
]
Parentheses
[
\makematrix[p]{1,3,7,-1,2;0,-3,3,4,5}
]
\end{document}

matrixtakes any number of rows and columns. In general a latex command taking an arbitrary number of arguments would use a,separated list, but for arrays it's easier to use&You could iterate over a,list replacing them with&, but why? – David Carlisle Jun 25 '22 at 07:56sagetexanswer in this post. It avoids complicated coding by having a CAS do the work. – DJP Jun 25 '22 at 23:03