This is a followup to this question.
Why does this code not compile, and how do I fix it?
trait Vec[V] { self:V =>
def -(v:V):V
def dot(v:V):Double
def norm:Double = math.sqrt(this dot this)
def dist(v:V):Double = (this - v).norm
}
The error is:
Vec.scala:6: error: value norm is not a member of type parameter V
def dist(v:V):V = (this - v).norm
^