Idris2/libs/contrib/Data/Vect/Extra.idr
Ohad Kammar 823230b77c
Vect reasoning library (#1439)
When working on Frex I needed a whole bunch of lemmata to do with Data.Vect. I hope it will be useful for others.
2021-05-20 11:55:22 +01:00

12 lines
305 B
Idris

||| Additional functions about vectors
module Data.Vect.Extra
import Data.Vect
import Data.Fin
||| Version of `map` with access to the current position
public export
mapWithPos : (f : Fin n -> a -> b) -> Vect n a -> Vect n b
mapWithPos f [] = []
mapWithPos f (x :: xs) = f 0 x :: mapWithPos (f . FS) xs