Calling macro recursively for all prefixes of the arg list

It is easy to write a macro that calls itself on all suffixes of the argument list:

macro_rules! suffixes {
    () => {};
    ($first:ident, $($tail:ident),*) => {

Is it possible to write a macro that calls itself for all the prefixes?
That is, a call to prefixes!(a0, a1, a2) should actually call:

prefixes!(a0, a1, a2);
prefixes!(a0, a1);

The naive way of doing it by just swapping the order of matching does not work, because it creates parsing ambiguity.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.