take_while implementation