Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
implicit class EncogArray1[T](val elem1: T) {
def |(v: T) = new EncogArray2[T](elem1, v)
}
case class EncogArray2[T](elem1: T, elem2: T) {
def |(v: T) = new EncogArray3[T](elem1, elem2, v)
}
case class EncogArray3[T](elem1: T, elem2: T, elem3: T) {
def |(v: T) = new EncogArray4[T](elem1, elem2, elem3, v)
}
case class EncogArray4[T](elem1: T, elem2: T, elem3: T, elem4: T) {
def |(v: T) = new EncogArray5[T](elem1, elem2, elem3, elem4, v)
}
case class EncogArray5[T](elem1: T, elem2: T, elem3: T, elem4: T, elem5: T) {
def |(v: T): EncogArray5[T] = throw new UnsupportedOperationException("DSL (for now) handles Arrays up to 4 elements!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment