Stream.takeWhile implemented using foldRight