Pattern matching for operations