Skip to content

Instantly share code, notes, and snippets.

@okomok
Created January 30, 2009 04:08
Show Gist options
  • Save okomok/54933 to your computer and use it in GitHub Desktop.
Save okomok/54933 to your computer and use it in GitHub Desktop.
Triples
package mada.vec
/*
private[mada] object TriplesVector {
def apply[A](from: Vector[Vector.Triple[A]]): Vector[Vector[A]] = from match {
case from: VectorTriples[_] => from.from // conversion fusion
case _ => new TriplesVector(from)
}
}
private[mada] class TriplesVector[A](val from: Vector[Vector.Triple[A]]) extends VectorProxy[Vector[A]] with NotWritable[Vector[A]] {
override val self = from.map({ v => Vector.tripleVector(v) })
}
private[mada] object VectorTriples {
def apply[A](from: Vector[Vector[A]]): Vector[Vector.Triple[A]] = from match {
case from: TriplesVector[_] => from.from // conversion fusion
case _ => new VectorTriples(from)
}
}
private[mada] class VectorTriples[A](val from: Vector[Vector[A]]) extends VectorProxy[Vector.Triple[A]] with NotWritable[Vector.Triple[A]] {
override val self = from.map({ v => v.triple })
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment