Skip to content

Instantly share code, notes, and snippets.

@mepcotterell
Created June 23, 2011 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mepcotterell/1042873 to your computer and use it in GitHub Desktop.
Save mepcotterell/1042873 to your computer and use it in GitHub Desktop.
Here is an implementation of a generic, numeric vector in Scala that utilizes mixin compositions with context-bounded type parameters.
package scalation
package advmath
object Vec {
}
class Vec [A: Numeric] extends VecLike[A, Vec[A]] {
}
package scalation
package advmath
abstract class VecLike [A: Numeric, Repr[A]] {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment