-
Notifications
You must be signed in to change notification settings - Fork 19
2.03 Extract a column or row
Boris Shilov edited this page Jun 21, 2019
·
3 revisions
A CollSeqN is also a ProductN (essentially a tuple). To extract a column:
import com.github.marklister.collections._
CollSeq(("A",2,3.1),
("B",3,4.0),
("C",4,5.2))._1
res1: Seq[String] = List(A, B, C)
Repeatedly extracting the same column will return a cached copy of the same Seq.
CollSeq is an IndexedSeq so you can extract a row in the normal manner:
import com.github.marklister.collections._
CollSeq(("A",2,3.1),
("B",3,4.0),
("C",4,5.2)) (1)
res4: Product3[java.lang.String,Int,Int] = (B,3,4)