Are you aware that in TeX/LaTeX undelimited arguments consisting of a single token don't need to be nested in braces?
After defining \newcommand\foo[1]{This is argument 1: #1.},
\foo{b} will yield the same result as
\foo b.
After defining \newcommand\foo[2]{This is argument 1: #1. This is argument 2: #2.}, the following calls will all yield the same result:
\foo{a}{b}
\foo a{b}
\foo {a}b
\foo ab
\foo{a} {b}
\foo a {b}
\foo {a} b
\foo a b
This is because
- you don't need braces when undelimited arguments consist of a single token.
- (La)TeX does discard space tokens preceding undelimited arguments.
When called as \mycomm{a}{b}c—how shall \mycomm "know" whether the user intends to have c as \mycomm's third argument which consists of the single token c or whether the user intends to have \mycomm called with only two arguments, namely {a} and {b} while c shall not be considered a third argument?
The situation is ambiguous.
You can turn the situation into something unambiguous by having \mycomm process only one undelimited argument and having \mycomm check whether that argument in turn is of one of the patterns
{⟨argument 1⟩}
{⟨argument 1⟩}{⟨argument 2⟩}
{⟨argument 1⟩}{⟨argument 2⟩}{⟨argument 3⟩}
...
{⟨argument 1⟩}{⟨argument 2⟩}{⟨argument 3⟩}...{⟨argument k⟩}
and have \mycomm act accordingly in case one of these patterns is detected and have \mycomm delivering an error-message otherwise.
I.e.,
\mycomm{{⟨argument 1⟩}}
\mycomm{{⟨argument 1⟩}{⟨argument 2⟩}}
\mycomm{{⟨argument 1⟩}{⟨argument 2⟩}{⟨argument 3⟩}}
...
\mycomm{{⟨argument 1⟩}{⟨argument 2⟩}{⟨argument 3⟩}...{⟨argument k⟩}}
Yesterday I answered a question similar to yours, subject: How to define a command with two optional arguments?, and provided an example for doing this with up to three arguments.
You can easily adapt that example, using the same strategy, for detecting up to nine arguments.
But in your scenario, where the situation is about users who might provide specific data, it may be better to have a key-value-interface, so that the user can pass the data she likes to pass via a comma-separated-key-value-list and thus is urged to specify by providing not only a value but the key also, what data she wishes to provide.
Something that the user can use like:
\homeworkdata[FirstName=Jason, LastName=Smith]{1}{2}{3}{4},
yielding that the name of the user is used.
\homeworkdata[LastName=Smith, FirstName=Jason]{1}{2}{3}{4},
yielding that the name of the user is used.
\homeworkdata{1}{2}{3}{4},
yielding that the defaults "First name" and "Last name" are used.
There are a lot of packages providing means for implementing key-val syntax:
https://ctan.org/topic/keyval
With these packages you can provide default-values which are used in case the user does not specify other values. For the key FirstName you could specify the default value First name and for the key LastName you could specify the defaule value Last name.
\mycomm{a}{b} Then some stuffhas argumentsa,bandT. – Joseph Wright Sep 01 '18 at 17:08\z{ }{ }[ ]where the 3rd argument (in brackets) is optional. Would that suit your needs? – Steven B. Segletes Sep 01 '18 at 17:16\homeworkdata, instead of describing them in words. For example,\homeworkdata{Jason}{Smith}{3}{4}{5}{6}versus\homeworkdata{Jason Smith}{3}{4}{5}{6}. Are those the two possibilities? You might be able to look for a space in the first argument. – Teepeemm Sep 01 '18 at 17:42