The relationship between coroutines generators and functions