Uses a visitor function to iterate over configurations