void main() { forcePrint(testZip()); std::cout << testUnit() << std::endl; auto s = testCat(); lazyPrint(s); forcePrint(s); }
Stream<int> test3() { auto s4 = test1(); auto rv = s4.reverse(); std::cout << "Reversed\n"; lazyPrint(rv); forcePrint(rv); auto cat = concat(s4, rv); return cat; }
Stream<int> test() { auto cat = test3(); Stream<int> s(10, cat); std::cout << "Cat + 10\n"; lazyPrint(s); forcePrint(s); auto t2 = cat.take(5); return t2; }
void forcePrint(Stream<T> const & s) { if (s.isEmpty()) { std::cout << std::endl; } else { T v = s.get(); auto tail = s.pop_front(); std::cout << v << " "; forcePrint(tail); } }