I have a function of the following form:
def tTest[T](it1 : TraversableOnce[T], it2 : Option[TraversableOnce[T]] = None)
(implicit frac: Fractional[T]) = {
...
}
My intent is to call it like so:
tTest( Array(1.0,2,3,4), Option(Array(1.0,8,7)) )
and also sometimes like:
tTest( Array(1.0,2,3,4) )
The second one works fine, but when I try to call the first, I get the following:
scala:14: type mismatch;
found : Option[Array[Double]]
required: Option[TraversableOnce[?]]
[EDIT] this code works fine:
tTest( Array(1.0,2,3,4), Option(Array(1.0,8,7).toTraversable) )
My question is this: What is the relationship between Array and TraversableOnce in Scala? Intuitively, I would think the above should work, since an array is in fact traversable at least once.
On a practical note, what is the simplest way to get this to work for Arrays, Sets, Streams, and any other data structure that is traversable once?