Skip to content
Snippets Groups Projects
Commit f2bca8eb authored by geoffrey.menetrey's avatar geoffrey.menetrey
Browse files

some more comments

parent 8a83461f
No related branches found
No related tags found
No related merge requests found
...@@ -3,10 +3,19 @@ import scala.math.sqrt ...@@ -3,10 +3,19 @@ import scala.math.sqrt
case class Vector(var list : List[Double]) { case class Vector(var list : List[Double]) {
// return the number of elements in the vector
val size = () => this.list.size val size = () => this.list.size
// return the element at index i
val get = (i : Int) => this.list(i) val get = (i : Int) => this.list(i)
// verify if two vectors are equals
val equals = (v : Vector) => this.list == v.list val equals = (v : Vector) => this.list == v.list
// update an element with a value at index i
val update = (i : Int, value : Double) => this.list = this.list.updated(i, value) val update = (i : Int, value : Double) => this.list = this.list.updated(i, value)
// verify if two vectors have the same size
val sameSize = (v : Vector) => this.size() == v.size() val sameSize = (v : Vector) => this.size() == v.size()
// Add Terminal recursive // Add Terminal recursive
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment