list.takeWhile function

Keep taking elements while a condition holds