- Syntax::argument_error (scm_length (args),
- pred, arg);
- SCM val = scm_car (get_signature ());
- val = scm_is_pair (val) ? scm_cdr (val) : SCM_BOOL_F;
- return with_loc (val, location);
+ // optional argument, non-match
+ // *unspecified* is the same as an explicit \default: skip it
+ if (scm_is_eq (arg, SCM_UNSPECIFIED))
+ rest = scm_cdr (rest);
+ // Replace this and all following optional arguments with
+ // their defaults:
+ do {
+ args = scm_cons (with_loc (scm_cdr (pred), location), args);
+ signature = scm_cdr (signature);
+ if (!scm_is_pair (signature))
+ break;
+ pred = scm_car (signature);
+ } while (scm_is_pair (pred));
+ continue;