core
VectorN
/=
defn
(λ [a, a] Bool)
(/= a b)
=
defn
(λ [(Ref (VectorN a)), (Ref (VectorN a))] Bool)
(= a b)
add
defn
(λ [(Ref (VectorN a)), (Ref (VectorN a))] (Maybe (VectorN a)))
(add a b)
angle-between
defn
(λ [(Ref (VectorN Double)), (Ref (VectorN Double))] (Maybe Double))
(angle-between a b)
Get the angle between to vectors a and b.
anti-parallel?
defn
(λ [(Ref (VectorN Double)), (Ref (VectorN Double))] (Maybe Bool))
(anti-parallel? a b)
Check whether the two vectors a and b are anti-parallel.
copy
template
(λ [(Ref (VectorN a))] (VectorN a))
copies the VectorN
.
delete
template
(λ [(VectorN a)] ())
deletes a VectorN
. Should usually not be called manually.
dist
defn
(λ [(Ref (VectorN Double)), (Ref (VectorN Double))] (Maybe Double))
(dist a b)
Get the distance between the vectors a and b.
div
defn
(λ [(Ref (VectorN a)), a] (VectorN a))
(div a n)
dot
defn
(λ [(Ref (VectorN Double)), (Ref (VectorN Double))] (Maybe Double))
(dot x y)
Get the dot product of the two vectors x and y.
init
template
(λ [Int, (Array a)] (VectorN a))
creates a VectorN
.
lerp
defn
(λ [(Ref (VectorN a)), (Ref (VectorN a)), a] (Maybe (VectorN a)))
(lerp a b amnt)
Linearly interpolate between the two vectors a and b by amnt (between 0 and 1).
mag
defn
(λ [(Ref (VectorN Double))] Double)
(mag o)
Get the magnitude of a vector.
mag-sq
defn
(λ [(Ref (VectorN Double))] Double)
(mag-sq o)
Get the squared magnitude of a vector.
mul
defn
(λ [(Ref (VectorN a)), a] (VectorN a))
(mul a n)
n
instantiate
(λ [(Ref (VectorN a))] &Int)
gets the n
property of a VectorN
.
normalize
defn
(λ [(Ref (VectorN Double))] (VectorN Double))
(normalize o)
Normalize a vector.
parallel?
defn
(λ [(Ref (VectorN Double)), (Ref (VectorN Double))] (Maybe Bool))
(parallel? a b)
Check whether the two vectors a and b are parallel.
perpendicular?
defn
(λ [(Ref (VectorN Double)), (Ref (VectorN Double))] (Maybe Bool))
(perpendicular? a b)
Check whether the two vectors a and b are perpendicular.
prn
template
(λ [(Ref (VectorN a))] String)
converts a VectorN
to a string.
random-sized
defn
(λ [Int] (VectorN Double))
(random-sized n)
set-n
instantiate
(λ [(VectorN a), Int] (VectorN a))
sets the n
property of a VectorN
.
set-n!
instantiate
(λ [(Ref (VectorN a)), Int] ())
sets the n
property of a VectorN
in place.
set-v
template
(λ [(VectorN a), (Array a)] (VectorN a))
sets the v
property of a VectorN
.
set-v!
instantiate
(λ [(Ref (VectorN a)), (Array a)] ())
sets the v
property of a VectorN
in place.
str
template
(λ [(Ref (VectorN a))] String)
converts a VectorN
to a string.
sub
defn
(λ [(Ref (VectorN a)), (Ref (VectorN a))] (Maybe (VectorN a)))
(sub a b)
update-n
instantiate
(λ [(VectorN a), (Ref (λ [Int] Int))] (VectorN a))
updates the n
property of a VectorN
using a function f
.
update-v
instantiate
(λ [(VectorN a), (Ref (λ [(Array a)] (Array a)))] (VectorN a))
updates the v
property of a VectorN
using a function f
.
v
instantiate
(λ [(Ref (VectorN a))] (Ref (Array a)))
gets the v
property of a VectorN
.
zero-sized
defn
(λ [Int] (VectorN Double))
(zero-sized n)
zip
defn
(λ [(λ [a, b] c), (Ref (VectorN a)), (Ref (VectorN b))] (Maybe (VectorN c)))
(zip f a b)
zip-
defn
(λ [(λ [a, b] c), (Ref (Array a)), (Ref (Array b))] (VectorN c))
(zip- f a b)