【发布时间】:2014-11-14 17:22:33
【问题描述】:
我需要帮助将两个流合并为一个。输出必须如下:
(elem1list1#elem1list2, elem2list1#elem2list2...)
如果任何流为空,函数就会中断
def mergeStream(a: Stream[A], b: Stream[A]):Stream[A] =
if (a.isEmpty || b.isEmpty) Nil
else (a,b) match {
case(x#::xs, y#::ys) => x#::y
}
有什么办法解决吗?
【问题讨论】: