base: support optional arguments in export type declarations.

The algorithm is approximately to collect every possible
permutation of argument type-spec list with and without any
optional arguments.  An optional argument in the last position
must match the given type or nil, so that the permutation with
the final optional removed matches, allowing an uncaught
mismatched type at that position.  Then we try to match the
actual arguments against each permutation until one passes,
otherwise diagnose the mismatch, reporting that any type
at the mismatched index from all permutations is required.
* specs/base_spec.yaml (export): Specify behaviours when called
with a declaration containing an optional argument wrappend in
square brackets.
* lib/std/base.lua (match, formaterror): New functions; factored
out of argcheck.
(copy, match, normalize, permutations): New functions; support
classification of matchable argument type-specs.
(export): Use them to implement optional arguments in export
type declarations to satisfy new specifications.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>