mirror of
https://github.com/idris-lang/Idris2.git
synced 2025-01-05 15:08:00 +03:00
823230b77c
When working on Frex I needed a whole bunch of lemmata to do with Data.Vect. I hope it will be useful for others.
12 lines
305 B
Idris
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
|