Implement takenWhile