Add more array utility functions
This commit is contained in:
parent
03d06a42aa
commit
acd0cb6aa5
4 changed files with 57 additions and 10 deletions
|
|
@ -11,6 +11,14 @@ Vector : Nat -> Type -> Type
|
|||
Vector n = Array [n]
|
||||
|
||||
|
||||
public export
|
||||
dim : Vector n a -> Nat
|
||||
dim = head . shape
|
||||
|
||||
export
|
||||
dimEq : (v : Vector n a) -> n = dim v
|
||||
dimEq v = cong head $ shapeEq v
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Vector constructors
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
@ -107,3 +115,4 @@ export
|
|||
perp : Neg a => Vector 2 a -> Vector 2 a -> a
|
||||
perp a b = a.x * b.y - a.y * b.x
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue