Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
34
Task/Vector/Nanoquery/vector.nanoquery
Normal file
34
Task/Vector/Nanoquery/vector.nanoquery
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
class Vector
|
||||
declare x
|
||||
declare y
|
||||
|
||||
def Vector(x, y)
|
||||
this.x = float(x)
|
||||
this.y = float(y)
|
||||
end
|
||||
|
||||
def operator+(other)
|
||||
return new(Vector, this.x + other.x, this.y + other.y)
|
||||
end
|
||||
|
||||
def operator-(other)
|
||||
return new(Vector, this.x - other.x, this.y - other.y)
|
||||
end
|
||||
|
||||
def operator/(val)
|
||||
return new(Vector, this.x / val, this.y / val)
|
||||
end
|
||||
|
||||
def operator*(val)
|
||||
return new(Vector, this.x * val, this.y * val)
|
||||
end
|
||||
|
||||
def toString()
|
||||
return format("[%s, %s]", this.x, this.y)
|
||||
end
|
||||
end
|
||||
|
||||
println new(Vector, 5, 7) + new(Vector, 2, 3)
|
||||
println new(Vector, 5, 7) - new(Vector, 2, 3)
|
||||
println new(Vector, 5, 7) * 11
|
||||
println new(Vector, 5, 7) / 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue