This commit is contained in:
parent
9e90bdfc33
commit
ca0031431d
19 changed files with 287 additions and 0 deletions
21
examples/pos.ang
Normal file
21
examples/pos.ang
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
type Vec2 = (float, float)
|
||||
|
||||
fn add(a: Vec2, b: Vec2) -> Vec2 {
|
||||
(a[0] + b[0], a[1] + b[1])
|
||||
}
|
||||
|
||||
fn sub(a: Vec2, b: Vec2) -> Vec2 {
|
||||
(a[0] - b[0], a[1] - b[1])
|
||||
}
|
||||
|
||||
fn dot(a: Vec2, b: Vec2) -> float {
|
||||
a[0]*b[0] + a[1]*b[1]
|
||||
}
|
||||
|
||||
u := (0.0, 1.0)
|
||||
v := (2.0, 3.0)
|
||||
|
||||
println(add(u, v))
|
||||
println(sub(u, v))
|
||||
println(dot(u, v))
|
||||
Loading…
Add table
Add a link
Reference in a new issue