You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to Scala version 2.8.0.r21803-b20100505020119 (JavaHotSpot(TM) 64-BitServerVM, Java1.6.0_19).
scala>Seq(Set(1,2,3),Set(4,5,6),Set(7,8,9)).map(_.toList).transpose
res0:Seq[Seq[Int]] =List(List(1, 4, 7), List(2, 5, 8), List(3, 6, 9))
scala>Seq(Set(1,2,3),Set(4,5,6),Set(7,8,9)).transpose
java.lang.IndexOutOfBoundsException:1
at scala.collection.mutable.ResizableArray$$class.apply(ResizableArray.scala:46)
at scala.collection.mutable.ArrayBuffer.apply(ArrayBuffer.scala:44)
at scala.collection.generic.GenericTraversableTemplate$$$$anonfun$$transpose$$1$$$$anonfun$$apply$$1.apply(GenericTraversableTemplate.scala:115)
at scala.collection.generic.GenericTraversableTemplate$$$$anonfun$$transpose$$1$$$$anonfun$$apply$$1.apply(GenericTraversableTemplate.scala:114)
at scala.collection.immutable.Set$$Set3.foreach(Set.scala:123)
at scala.collection.generic.GenericTraversableTemplate$$$$anonfun$$transpose$$1.apply(GenericTraversableTemplate.scala:114)
at scala.collection.generic.GenericTraversableTemplate$$$$anonfun$$transpose$$1.apply(GenericTraversableTemplate.scala:112)
at scala.collection.Linear...
The text was updated successfully, but these errors were encountered:
If I had to implement transpose, this is how I would do it if I couldn't just fail. I don't know if this behavior is ever actually desired, though, so perhaps transpose should throw an exception on irregular matrices. #3399 might be related.
The text was updated successfully, but these errors were encountered: