pattern should be a list