but can't figure out how to pass a variable to name the interrupt service routines. Is there a better way to write repeated attachInterrupt functions? Thanks!
What do you imagine you gain by doing that? It will likely compile to LARGER code, use more RAM, and run slower. Fewer lines of source code does not necessarily mean less code after compilation, or faster code.
I might end up using 16 attachInterrupt functions on my ESP32 project, so am thinking a better way to write the code. It will save me time down the road if I have to modify the code.
If you're uncertain how many interrupts you'll be using in the final sketch, a loop like that is a good way to minimize the amount of modifications you need to do to add another interrupt. There are some other optimizations you can do.
For starters, make the computer work for you. Instead of hardcoding that you have 4 elements in the array (which requires manual editing if you change the size of the array), you can use a macro function like #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) to make the computer keep track of how much stiff you have in the array.
The other thing you can do is combine both the pin and the ISR pointer into a single data type using a struct. Then just make an array of those structs to hold the pin/function pairs.