implementation using array operators